From 6f1490d2388402a82a1613c190c4d134780d5f08 Mon Sep 17 00:00:00 2001 From: Alistair Michael Date: Fri, 27 Oct 2023 15:22:08 +1000 Subject: [PATCH 01/11] update expected --- src/main/scala/boogie/BProgram.scala | 42 ++-- .../scala/specification/Specification.scala | 2 +- src/main/scala/translating/IRToBoogie.scala | 35 ++-- .../clang/arrays_simple.expected | 48 ++--- .../clang_O2/arrays_simple.expected | 24 +-- .../arrays_simple.expected | 48 ++--- .../clang_pic/arrays_simple.expected | 48 ++--- .../gcc_O2/arrays_simple.expected | 24 +-- .../clang/basic_arrays_read.expected | 50 ++--- .../clang_O2/basic_arrays_read.expected | 38 ++-- .../basic_arrays_read.expected | 50 ++--- .../clang_pic/basic_arrays_read.expected | 54 ++--- .../gcc/basic_arrays_read.expected | 38 ++-- .../gcc_O2/basic_arrays_read.expected | 38 ++-- .../basic_arrays_read.expected | 38 ++-- .../gcc_pic/basic_arrays_read.expected | 42 ++-- .../clang/basic_arrays_write.expected | 56 ++--- .../clang_O2/basic_arrays_write.expected | 46 ++--- .../basic_arrays_write.expected | 56 ++--- .../clang_pic/basic_arrays_write.expected | 60 +++--- .../gcc/basic_arrays_write.expected | 52 ++--- .../gcc_O2/basic_arrays_write.expected | 46 ++--- .../basic_arrays_write.expected | 52 ++--- .../gcc_pic/basic_arrays_write.expected | 56 ++--- .../clang/basic_assign_assign.expected | 44 ++-- .../clang_O2/basic_assign_assign.expected | 44 ++-- .../basic_assign_assign.expected | 44 ++-- .../clang_pic/basic_assign_assign.expected | 48 ++--- .../gcc/basic_assign_assign.expected | 40 ++-- .../gcc_O2/basic_assign_assign.expected | 44 ++-- .../basic_assign_assign.expected | 40 ++-- .../gcc_pic/basic_assign_assign.expected | 44 ++-- .../clang/basic_assign_increment.expected | 50 ++--- .../clang_O2/basic_assign_increment.expected | 50 ++--- .../basic_assign_increment.expected | 50 ++--- .../clang_pic/basic_assign_increment.expected | 54 ++--- .../gcc/basic_assign_increment.expected | 46 ++--- .../gcc_O2/basic_assign_increment.expected | 50 ++--- .../basic_assign_increment.expected | 46 ++--- .../gcc_pic/basic_assign_increment.expected | 50 ++--- .../clang/basic_function_call_caller.expected | 88 ++++---- .../basic_function_call_caller.expected | 58 +++--- .../basic_function_call_caller.expected | 88 ++++---- .../basic_function_call_caller.expected | 88 ++++---- .../gcc/basic_function_call_caller.expected | 80 ++++---- .../basic_function_call_caller.expected | 58 +++--- .../basic_function_call_caller.expected | 80 ++++---- .../basic_function_call_caller.expected | 80 ++++---- .../clang/basic_function_call_reader.expected | 90 ++++---- .../basic_function_call_reader.expected | 82 ++++---- .../basic_function_call_reader.expected | 90 ++++---- .../basic_function_call_reader.expected | 94 ++++----- .../gcc/basic_function_call_reader.expected | 86 ++++---- .../basic_function_call_reader.expected | 44 ++-- .../basic_function_call_reader.expected | 86 ++++---- .../basic_function_call_reader.expected | 90 ++++---- .../clang/basic_lock_read.expected | 92 ++++----- .../clang_O2/basic_lock_read.expected | 50 ++--- .../basic_lock_read.expected | 92 ++++----- .../clang_pic/basic_lock_read.expected | 96 ++++----- .../gcc/basic_lock_read.expected | 88 ++++---- .../gcc_O2/basic_lock_read.expected | 52 ++--- .../basic_lock_read.expected | 88 ++++---- .../gcc_pic/basic_lock_read.expected | 92 ++++----- .../clang/basic_lock_security_read.expected | 90 ++++---- .../basic_lock_security_read.expected | 82 ++++---- .../basic_lock_security_read.expected | 90 ++++---- .../basic_lock_security_read.expected | 94 ++++----- .../gcc/basic_lock_security_read.expected | 86 ++++---- .../gcc_O2/basic_lock_security_read.expected | 50 ++--- .../basic_lock_security_read.expected | 86 ++++---- .../gcc_pic/basic_lock_security_read.expected | 90 ++++---- .../clang/basic_lock_security_write.expected | 68 +++--- .../basic_lock_security_write.expected | 54 ++--- .../basic_lock_security_write.expected | 68 +++--- .../basic_lock_security_write.expected | 72 +++---- .../gcc/basic_lock_security_write.expected | 60 +++--- .../gcc_O2/basic_lock_security_write.expected | 54 ++--- .../basic_lock_security_write.expected | 60 +++--- .../basic_lock_security_write.expected | 64 +++--- .../clang/basic_lock_unlock.expected | 50 ++--- .../clang_O2/basic_lock_unlock.expected | 54 ++--- .../basic_lock_unlock.expected | 50 ++--- .../clang_pic/basic_lock_unlock.expected | 54 ++--- .../gcc/basic_lock_unlock.expected | 46 ++--- .../gcc_O2/basic_lock_unlock.expected | 54 ++--- .../basic_lock_unlock.expected | 46 ++--- .../gcc_pic/basic_lock_unlock.expected | 50 ++--- .../clang/basic_loop_assign.expected | 48 ++--- .../clang_O2/basic_loop_assign.expected | 48 ++--- .../basic_loop_assign.expected | 48 ++--- .../clang_pic/basic_loop_assign.expected | 52 ++--- .../gcc/basic_loop_assign.expected | 44 ++-- .../gcc_O2/basic_loop_assign.expected | 48 ++--- .../basic_loop_assign.expected | 44 ++-- .../gcc_pic/basic_loop_assign.expected | 48 ++--- .../clang/basic_operation_evaluation.expected | 112 +++++----- .../basic_operation_evaluation.expected | 24 +-- .../basic_operation_evaluation.expected | 112 +++++----- .../basic_operation_evaluation.expected | 112 +++++----- .../gcc/basic_operation_evaluation.expected | 72 +++---- .../basic_operation_evaluation.expected | 24 +-- .../basic_operation_evaluation.expected | 72 +++---- .../basic_operation_evaluation.expected | 72 +++---- .../clang/basic_sec_policy_read.expected | 90 ++++---- .../clang_O2/basic_sec_policy_read.expected | 82 ++++---- .../basic_sec_policy_read.expected | 90 ++++---- .../clang_pic/basic_sec_policy_read.expected | 94 ++++----- .../gcc/basic_sec_policy_read.expected | 86 ++++---- .../gcc_O2/basic_sec_policy_read.expected | 50 ++--- .../basic_sec_policy_read.expected | 86 ++++---- .../gcc_pic/basic_sec_policy_read.expected | 90 ++++---- .../clang/basic_sec_policy_write.expected | 66 +++--- .../clang_O2/basic_sec_policy_write.expected | 56 ++--- .../basic_sec_policy_write.expected | 66 +++--- .../clang_pic/basic_sec_policy_write.expected | 70 +++---- .../gcc/basic_sec_policy_write.expected | 58 +++--- .../gcc_O2/basic_sec_policy_write.expected | 56 ++--- .../basic_sec_policy_write.expected | 58 +++--- .../gcc_pic/basic_sec_policy_write.expected | 62 +++--- .../clang/basicassign_gamma0.expected | 50 ++--- .../clang_O2/basicassign_gamma0.expected | 50 ++--- .../basicassign_gamma0.expected | 50 ++--- .../clang_pic/basicassign_gamma0.expected | 54 ++--- .../gcc/basicassign_gamma0.expected | 46 ++--- .../gcc_O2/basicassign_gamma0.expected | 50 ++--- .../basicassign_gamma0.expected | 46 ++--- .../gcc_pic/basicassign_gamma0.expected | 50 ++--- .../basicfree/clang/basicfree.expected | 84 ++++---- .../basicfree/clang_O2/basicfree.expected | 20 +- .../clang_no_plt_no_pic/basicfree.expected | 84 ++++---- .../basicfree/clang_pic/basicfree.expected | 84 ++++---- .../correct/basicfree/gcc/basicfree.expected | 76 +++---- .../basicfree/gcc_O2/basicfree.expected | 20 +- .../gcc_no_plt_no_pic/basicfree.expected | 76 +++---- .../basicfree/gcc_pic/basicfree.expected | 76 +++---- src/test/correct/cjump/clang/cjump.expected | 94 ++++----- .../correct/cjump/clang_O2/cjump.expected | 54 ++--- .../cjump/clang_no_plt_no_pic/cjump.expected | 94 ++++----- .../correct/cjump/clang_pic/cjump.expected | 98 ++++----- src/test/correct/cjump/gcc/cjump.expected | 82 ++++---- src/test/correct/cjump/gcc_O2/cjump.expected | 50 ++--- .../cjump/gcc_no_plt_no_pic/cjump.expected | 82 ++++---- src/test/correct/cjump/gcc_pic/cjump.expected | 86 ++++---- .../correct/function/clang/function.expected | 76 +++---- .../function/clang_O2/function.expected | 54 ++--- .../clang_no_plt_no_pic/function.expected | 76 +++---- .../function/clang_pic/function.expected | 76 +++---- .../correct/function/gcc/function.expected | 74 +++---- .../correct/function/gcc_O2/function.expected | 50 ++--- .../gcc_no_plt_no_pic/function.expected | 74 +++---- .../function/gcc_pic/function.expected | 74 +++---- .../function1/clang/function1.expected | 114 +++++----- .../function1/clang_O2/function1.expected | 100 ++++----- .../clang_no_plt_no_pic/function1.expected | 114 +++++----- .../function1/clang_pic/function1.expected | 114 +++++----- .../correct/function1/gcc/function1.expected | 104 +++++----- .../function1/gcc_O2/function1.expected | 92 ++++----- .../gcc_no_plt_no_pic/function1.expected | 104 +++++----- .../function1/gcc_pic/function1.expected | 104 +++++----- .../clang/functions_with_params.expected | 76 +++---- .../clang_O2/functions_with_params.expected | 24 +-- .../functions_with_params.expected | 76 +++---- .../clang_pic/functions_with_params.expected | 76 +++---- .../gcc/functions_with_params.expected | 68 +++--- .../gcc_O2/functions_with_params.expected | 24 +-- .../functions_with_params.expected | 68 +++--- .../gcc_pic/functions_with_params.expected | 68 +++--- .../ifbranches/clang/ifbranches.expected | 88 ++++---- .../ifbranches/clang_O2/ifbranches.expected | 62 +++--- .../clang_no_plt_no_pic/ifbranches.expected | 88 ++++---- .../ifbranches/clang_pic/ifbranches.expected | 88 ++++---- .../ifbranches/gcc/ifbranches.expected | 84 ++++---- .../ifbranches/gcc_O2/ifbranches.expected | 58 +++--- .../gcc_no_plt_no_pic/ifbranches.expected | 84 ++++---- .../ifbranches/gcc_pic/ifbranches.expected | 84 ++++---- .../correct/ifglobal/clang/ifglobal.expected | 90 ++++---- .../ifglobal/clang_O2/ifglobal.expected | 48 ++--- .../clang_no_plt_no_pic/ifglobal.expected | 90 ++++---- .../ifglobal/clang_pic/ifglobal.expected | 94 ++++----- .../correct/ifglobal/gcc/ifglobal.expected | 78 +++---- .../correct/ifglobal/gcc_O2/ifglobal.expected | 46 ++--- .../gcc_no_plt_no_pic/ifglobal.expected | 78 +++---- .../ifglobal/gcc_pic/ifglobal.expected | 82 ++++---- .../clang_O2/indirect_call.expected | 64 +++--- .../gcc_O2/indirect_call.expected | 66 +++--- .../clang/initialisation.expected | 116 +++++------ .../clang_O2/initialisation.expected | 100 ++++----- .../initialisation.expected | 116 +++++------ .../clang_pic/initialisation.expected | 112 +++++----- .../gcc/initialisation.expected | 72 +++---- .../gcc_O2/initialisation.expected | 92 ++++----- .../gcc_no_plt_no_pic/initialisation.expected | 72 +++---- .../gcc_pic/initialisation.expected | 72 +++---- .../jumptable/clang_O2/jumptable.expected | 52 ++--- .../jumptable/gcc_O2/jumptable.expected | 82 ++++---- .../jumptable3/gcc/jumptable3.expected | 194 +++++++++--------- .../jumptable3/gcc_O2/jumptable3.expected | 112 +++++----- .../gcc_no_plt_no_pic/jumptable3.expected | 194 +++++++++--------- .../jumptable3/gcc_pic/jumptable3.expected | 194 +++++++++--------- .../clang/malloc_with_local.expected | 104 +++++----- .../clang_O2/malloc_with_local.expected | 68 +++--- .../malloc_with_local.expected | 104 +++++----- .../clang_pic/malloc_with_local.expected | 104 +++++----- .../gcc/malloc_with_local.expected | 92 ++++----- .../gcc_O2/malloc_with_local.expected | 72 +++---- .../malloc_with_local.expected | 92 ++++----- .../gcc_pic/malloc_with_local.expected | 92 ++++----- .../clang/malloc_with_local2.expected | 104 +++++----- .../clang_O2/malloc_with_local2.expected | 68 +++--- .../malloc_with_local2.expected | 104 +++++----- .../clang_pic/malloc_with_local2.expected | 104 +++++----- .../gcc/malloc_with_local2.expected | 92 ++++----- .../gcc_O2/malloc_with_local2.expected | 72 +++---- .../malloc_with_local2.expected | 92 ++++----- .../gcc_pic/malloc_with_local2.expected | 92 ++++----- .../clang/malloc_with_local3.expected | 116 +++++------ .../clang_O2/malloc_with_local3.expected | 68 +++--- .../malloc_with_local3.expected | 116 +++++------ .../clang_pic/malloc_with_local3.expected | 116 +++++------ .../gcc/malloc_with_local3.expected | 100 ++++----- .../gcc_O2/malloc_with_local3.expected | 100 ++++----- .../malloc_with_local3.expected | 100 ++++----- .../gcc_pic/malloc_with_local3.expected | 100 ++++----- .../multi_malloc/clang/multi_malloc.expected | 104 +++++----- .../clang_O2/multi_malloc.expected | 68 +++--- .../clang_no_plt_no_pic/multi_malloc.expected | 104 +++++----- .../clang_pic/multi_malloc.expected | 104 +++++----- .../multi_malloc/gcc/multi_malloc.expected | 92 ++++----- .../multi_malloc/gcc_O2/multi_malloc.expected | 72 +++---- .../gcc_no_plt_no_pic/multi_malloc.expected | 92 ++++----- .../gcc_pic/multi_malloc.expected | 92 ++++----- .../correct/nestedif/clang/nestedif.expected | 92 ++++----- .../nestedif/clang_O2/nestedif.expected | 24 +-- .../clang_no_plt_no_pic/nestedif.expected | 92 ++++----- .../nestedif/clang_pic/nestedif.expected | 92 ++++----- .../correct/nestedif/gcc/nestedif.expected | 88 ++++---- .../correct/nestedif/gcc_O2/nestedif.expected | 24 +-- .../gcc_no_plt_no_pic/nestedif.expected | 88 ++++---- .../nestedif/gcc_pic/nestedif.expected | 88 ++++---- .../clang/no_interference_update_x.expected | 48 ++--- .../no_interference_update_x.expected | 48 ++--- .../no_interference_update_x.expected | 48 ++--- .../no_interference_update_x.expected | 52 ++--- .../gcc/no_interference_update_x.expected | 44 ++-- .../gcc_O2/no_interference_update_x.expected | 48 ++--- .../no_interference_update_x.expected | 44 ++-- .../gcc_pic/no_interference_update_x.expected | 48 ++--- .../clang/no_interference_update_y.expected | 48 ++--- .../no_interference_update_y.expected | 48 ++--- .../no_interference_update_y.expected | 48 ++--- .../no_interference_update_y.expected | 52 ++--- .../gcc/no_interference_update_y.expected | 44 ++-- .../gcc_O2/no_interference_update_y.expected | 48 ++--- .../no_interference_update_y.expected | 44 ++-- .../gcc_pic/no_interference_update_y.expected | 48 ++--- .../secret_write/clang/secret_write.expected | 68 +++--- .../clang_O2/secret_write.expected | 64 +++--- .../clang_no_plt_no_pic/secret_write.expected | 68 +++--- .../clang_pic/secret_write.expected | 72 +++---- .../secret_write/gcc/secret_write.expected | 60 +++--- .../secret_write/gcc_O2/secret_write.expected | 64 +++--- .../gcc_no_plt_no_pic/secret_write.expected | 60 +++--- .../gcc_pic/secret_write.expected | 64 +++--- .../simple_jump/clang/simple_jump.expected | 84 ++++---- .../simple_jump/clang_O2/simple_jump.expected | 24 +-- .../clang_no_plt_no_pic/simple_jump.expected | 84 ++++---- .../clang_pic/simple_jump.expected | 84 ++++---- .../simple_jump/gcc/simple_jump.expected | 80 ++++---- .../simple_jump/gcc_O2/simple_jump.expected | 24 +-- .../gcc_no_plt_no_pic/simple_jump.expected | 80 ++++---- .../simple_jump/gcc_pic/simple_jump.expected | 80 ++++---- src/test/correct/switch/clang/switch.expected | 84 ++++---- .../correct/switch/clang_O2/switch.expected | 20 +- .../clang_no_plt_no_pic/switch.expected | 84 ++++---- .../correct/switch/clang_pic/switch.expected | 84 ++++---- src/test/correct/switch/gcc/switch.expected | 84 ++++---- .../correct/switch/gcc_O2/switch.expected | 20 +- .../switch/gcc_no_plt_no_pic/switch.expected | 84 ++++---- .../correct/switch/gcc_pic/switch.expected | 84 ++++---- .../correct/switch2/clang_O2/switch2.expected | 18 +- src/test/correct/switch2/gcc/switch2.expected | 132 ++++++------ .../correct/switch2/gcc_O2/switch2.expected | 18 +- .../gcc_no_plt_no_pic/switch2.expected | 132 ++++++------ .../correct/switch2/gcc_pic/switch2.expected | 132 ++++++------ .../correct/syscall/clang/syscall.expected | 82 ++++---- .../clang_no_plt_no_pic/syscall.expected | 82 ++++---- .../syscall/clang_pic/syscall.expected | 82 ++++---- src/test/correct/syscall/gcc/syscall.expected | 78 +++---- .../correct/syscall/gcc_O2/syscall.expected | 28 +-- .../gcc_no_plt_no_pic/syscall.expected | 78 +++---- .../correct/syscall/gcc_pic/syscall.expected | 78 +++---- .../clang/using_gamma_conditional.expected | 90 ++++---- .../clang_O2/using_gamma_conditional.expected | 78 +++---- .../using_gamma_conditional.expected | 90 ++++---- .../using_gamma_conditional.expected | 94 ++++----- .../gcc/using_gamma_conditional.expected | 74 +++---- .../gcc_O2/using_gamma_conditional.expected | 74 +++---- .../using_gamma_conditional.expected | 74 +++---- .../gcc_pic/using_gamma_conditional.expected | 78 +++---- .../clang/using_gamma_write_z.expected | 50 ++--- .../clang_O2/using_gamma_write_z.expected | 50 ++--- .../using_gamma_write_z.expected | 50 ++--- .../clang_pic/using_gamma_write_z.expected | 54 ++--- .../gcc/using_gamma_write_z.expected | 46 ++--- .../gcc_O2/using_gamma_write_z.expected | 50 ++--- .../using_gamma_write_z.expected | 46 ++--- .../gcc_pic/using_gamma_write_z.expected | 50 ++--- .../basicassign/clang/basicassign.expected | 62 +++--- .../basicassign/clang_O2/basicassign.expected | 58 +++--- .../clang_no_plt_no_pic/basicassign.expected | 62 +++--- .../clang_pic/basicassign.expected | 66 +++--- .../basicassign/gcc/basicassign.expected | 50 ++--- .../basicassign/gcc_O2/basicassign.expected | 58 +++--- .../gcc_no_plt_no_pic/basicassign.expected | 50 ++--- .../basicassign/gcc_pic/basicassign.expected | 54 ++--- .../basicassign1/clang/basicassign1.expected | 58 +++--- .../clang_O2/basicassign1.expected | 46 ++--- .../clang_no_plt_no_pic/basicassign1.expected | 58 +++--- .../clang_pic/basicassign1.expected | 62 +++--- .../basicassign1/gcc/basicassign1.expected | 50 ++--- .../basicassign1/gcc_O2/basicassign1.expected | 46 ++--- .../gcc_no_plt_no_pic/basicassign1.expected | 50 ++--- .../gcc_pic/basicassign1.expected | 54 ++--- .../basicassign2/clang/basicassign2.expected | 60 +++--- .../clang_O2/basicassign2.expected | 48 ++--- .../clang_no_plt_no_pic/basicassign2.expected | 60 +++--- .../clang_pic/basicassign2.expected | 60 +++--- .../basicassign2/gcc/basicassign2.expected | 52 ++--- .../basicassign2/gcc_O2/basicassign2.expected | 48 ++--- .../gcc_no_plt_no_pic/basicassign2.expected | 52 ++--- .../gcc_pic/basicassign2.expected | 52 ++--- .../basicassign3/clang/basicassign3.expected | 60 +++--- .../clang_O2/basicassign3.expected | 48 ++--- .../clang_no_plt_no_pic/basicassign3.expected | 60 +++--- .../clang_pic/basicassign3.expected | 64 +++--- .../basicassign3/gcc/basicassign3.expected | 52 ++--- .../basicassign3/gcc_O2/basicassign3.expected | 48 ++--- .../gcc_no_plt_no_pic/basicassign3.expected | 52 ++--- .../gcc_pic/basicassign3.expected | 56 ++--- .../incorrect/iflocal/clang/iflocal.expected | 80 ++++---- .../clang_no_plt_no_pic/iflocal.expected | 80 ++++---- .../iflocal/clang_pic/iflocal.expected | 80 ++++---- .../incorrect/iflocal/gcc/iflocal.expected | 76 +++---- .../gcc_no_plt_no_pic/iflocal.expected | 76 +++---- .../iflocal/gcc_pic/iflocal.expected | 76 +++---- .../clang/nestedifglobal.expected | 94 ++++----- .../nestedifglobal.expected | 94 ++++----- .../clang_pic/nestedifglobal.expected | 102 ++++----- .../gcc/nestedifglobal.expected | 90 ++++---- .../gcc_no_plt_no_pic/nestedifglobal.expected | 90 ++++---- .../gcc_pic/nestedifglobal.expected | 94 ++++----- 352 files changed, 12279 insertions(+), 12268 deletions(-) diff --git a/src/main/scala/boogie/BProgram.scala b/src/main/scala/boogie/BProgram.scala index 98312ff32..278381536 100644 --- a/src/main/scala/boogie/BProgram.scala +++ b/src/main/scala/boogie/BProgram.scala @@ -4,8 +4,14 @@ case class BProgram(declarations: List[BDeclaration]) { override def toString: String = declarations.flatMap(x => x.toBoogie).mkString("\n") } -trait BDeclaration { +trait BDeclaration(val _attributes: List[(String, String)]) { def toBoogie: List[String] = List(toString) + + val attrString: String = if (_attributes.nonEmpty) then { + _attributes.map(a => s"{${a._1} ${a._2}}").mkString(" ") + } else { + "" + } } case class BProcedure( @@ -19,12 +25,13 @@ case class BProcedure( freeEnsures: List[BExpr], freeRequires: List[BExpr], modifies: Set[BVar], - body: List[BCmdOrBlock] -) extends BDeclaration + body: List[BCmdOrBlock], + attributes: List[(String, String)] +) extends BDeclaration(attributes) with Ordered[BProcedure] { override def compare(that: BProcedure): Int = name.compare(that.name) override def toBoogie: List[String] = { - val header = s"procedure $name(${in.map(_.withType).mkString(", ")})" + val header = s"procedure $attrString $name(${in.map(_.withType).mkString(", ")})" val returns = if (out.nonEmpty) { s" returns (${out.map(_.withType).mkString(", ")})" } else { @@ -41,7 +48,7 @@ case class BProcedure( val freeRequiresStrs = freeRequires.map(r => s" free requires $r;") val freeEnsuresStrs = freeEnsures.map(e => s" free ensures $e;") val locals = body.flatMap(l => l.locals).distinct.sorted - val localDefs = locals.map(l => " " + BVarDecl(l).toString) + val localDefs = locals.map(l => " " + BVarDecl(l, List.empty).toString) val bodyStr = if (body.nonEmpty) { List("{") ++ localDefs ++ body.flatMap(x => x.toBoogie).map(s => " " + s) ++ List("}") } else { @@ -60,22 +67,19 @@ case class BProcedure( def globals: Set[BVar] = body.flatMap(c => c.globals).toSet ++ modifies } -case class BAxiom(body: BExpr) extends BDeclaration { - override def toString: String = s"axiom $body;" +case class BAxiom(body: BExpr, attributes: List[(String, String)]) extends BDeclaration(attributes) { + override def toString: String = s"axiom $attrString $body;" } -case class BFunction(name: String, bvbuiltin: String, in: List[BVar], out: BVar, body: Option[BExpr]) - extends BDeclaration +case class BFunction(name: String, in: List[BVar], out: BVar, body: Option[BExpr], + attributes: List[(String, String)]) + extends BDeclaration(attributes) with Ordered[BFunction] { + override def compare(that: BFunction): Int = name.compare(that.name) override def toBoogie: List[String] = { - val bvbuiltinString = if (bvbuiltin.isEmpty) { - "" - } else { - s" {:bvbuiltin \"$bvbuiltin\"}" - } val inString = in.map(_.withType).mkString(", ") - val declString = s"function$bvbuiltinString $name($inString) returns (${out.withType})" + val declString = s"function $attrString $name($inString) returns (${out.withType})" body match { case Some(b) => List(declString + " {", " " + b.toString, "}", "") case None => List(declString + ";") @@ -88,16 +92,16 @@ case class BFunction(name: String, bvbuiltin: String, in: List[BVar], out: BVar, } } -case class BVarDecl(variable: BVar) extends BDeclaration with Ordered[BVarDecl] { +case class BVarDecl(variable: BVar, attributes: List[(String, String)]) extends BDeclaration(attributes) with Ordered[BVarDecl] { def compare(that: BVarDecl): Int = variable.compare(that.variable) override def toString: String = if (variable.scope == Scope.Const) { - s"const $variable: ${variable.getType};" + s"const $attrString $variable: ${variable.getType};" } else { - s"var $variable: ${variable.getType};" + s"var $attrString $variable: ${variable.getType};" } } -case class BConstAxiomPair(const: BVarDecl, axiom: BAxiom) extends BDeclaration with Ordered[BConstAxiomPair] { +case class BConstAxiomPair(const: BVarDecl, axiom: BAxiom) extends BDeclaration(List.empty) with Ordered[BConstAxiomPair] { override def compare(that: BConstAxiomPair): Int = const.compare(that.const) override def toString: String = const.toString + "\n" + axiom.toString } diff --git a/src/main/scala/specification/Specification.scala b/src/main/scala/specification/Specification.scala index 3c3ffd7ff..fc0307c94 100644 --- a/src/main/scala/specification/Specification.scala +++ b/src/main/scala/specification/Specification.scala @@ -23,7 +23,7 @@ case class SpecGlobal(name: String, override val size: Int, arraySize: Option[In override val toAddrVar: BVar = BVariable("$" + s"${name}_addr", BitVecBType(64), Scope.Const) override val toOldVar: BVar = BVariable(s"${name}_old", BitVecBType(size), Scope.Local) override val toOldGamma: BVar = BVariable(s"Gamma_${name}_old", BoolBType, Scope.Local) - val toAxiom: BAxiom = BAxiom(BinaryBExpr(BoolEQ, toAddrVar, BitVecBLiteral(address, 64))) + val toAxiom: BAxiom = BAxiom(BinaryBExpr(BoolEQ, toAddrVar, BitVecBLiteral(address, 64)), List((":extern", ""))) override def resolveSpec: BMemoryLoad = BMemoryLoad( BMapVar("mem", MapBType(BitVecBType(64), BitVecBType(8)), Scope.Global), toAddrVar, diff --git a/src/main/scala/translating/IRToBoogie.scala b/src/main/scala/translating/IRToBoogie.scala index bc6d6addb..161586a2a 100644 --- a/src/main/scala/translating/IRToBoogie.scala +++ b/src/main/scala/translating/IRToBoogie.scala @@ -6,6 +6,7 @@ import specification._ import scala.collection.mutable.ArrayBuffer class IRToBoogie(var program: Program, var spec: Specification) { + private val externAttr = (":extern", "") private val globals = spec.globals private val controls = spec.controls private val controlled = spec.controlled @@ -35,12 +36,12 @@ class IRToBoogie(var program: Program, var spec: Specification) { def translate: BProgram = { val readOnlyMemory = memoryToCondition(program.readOnlyMemory) val procedures = program.procedures.map(f => translateProcedure(f, readOnlyMemory)) - val defaultGlobals = List(BVarDecl(mem), BVarDecl(Gamma_mem)) + val defaultGlobals = List(BVarDecl(mem, List(externAttr)), BVarDecl(Gamma_mem, List(externAttr))) val globalVars = procedures.flatMap(p => p.globals ++ p.freeRequires.flatMap(_.globals) ++ p.freeEnsures.flatMap(_.globals) ++ p.ensures.flatMap(_.globals) ++ p.requires.flatMap(_.globals)) - val globalDecls = (globalVars.map(b => BVarDecl(b)) ++ defaultGlobals).distinct.sorted.toList + val globalDecls = (globalVars.map(b => BVarDecl(b, List(externAttr))) ++ defaultGlobals).distinct.sorted.toList val globalConsts: List[BConstAxiomPair] = - globals.map(g => BConstAxiomPair(BVarDecl(g.toAddrVar), g.toAxiom)).toList.sorted + globals.map(g => BConstAxiomPair(BVarDecl(g.toAddrVar, List(externAttr)), g.toAxiom)).toList.sorted val guaranteeReflexive = BProcedure( "guarantee_reflexive", @@ -53,7 +54,8 @@ class IRToBoogie(var program: Program, var spec: Specification) { List(), List(), Set(mem, Gamma_mem), - guaranteesReflexive.map(g => BAssert(g)) + guaranteesReflexive.map(g => BAssert(g)), + List(externAttr) ) val rgProcs = genRely(relies, readOnlyMemory) :+ guaranteeReflexive @@ -82,15 +84,19 @@ class IRToBoogie(var program: Program, var spec: Specification) { } else { reliesUsed } - val relyProc = BProcedure("rely", List(), List(), relyEnsures, List(), List(), List(), readOnlyMemory, List(), Set(mem, Gamma_mem), List()) - val relyTransitive = BProcedure("rely_transitive", List(), List(), reliesUsed, List(), List(), List(), List(), List(), Set(mem, Gamma_mem), List(BProcedureCall("rely", List(), List()), BProcedureCall("rely", List(), List()))) - val relyReflexive = BProcedure("rely_reflexive", List(), List(), List(), List(), List(), List(), List(), List(), Set(), reliesReflexive.map(r => BAssert(r))) + val relyProc = BProcedure("rely", List(), List(), relyEnsures, List(), List(), List(), readOnlyMemory, List(), + Set(mem, Gamma_mem), List(), List(externAttr)) + val relyTransitive = BProcedure("rely_transitive", List(), List(), reliesUsed, List(), List(), List(), List(), List(), + Set(mem, Gamma_mem), List(BProcedureCall("rely", List(), List()), BProcedureCall("rely", List(), List())), + List(externAttr)) + val relyReflexive = BProcedure("rely_reflexive", List(), List(), List(), List(), List(), List(), List(), List(), + Set(), reliesReflexive.map(r => BAssert(r)), List(externAttr)) List(relyProc, relyTransitive, relyReflexive) } def functionOpToDefinition(f: FunctionOp): BFunction = { f match { - case b: BVFunctionOp => BFunction(b.name, b.bvbuiltin, b.in, b.out, None) + case b: BVFunctionOp => BFunction(b.name, b.in, b.out, None, List(externAttr, (":bvbuiltin", s"\"${b.bvbuiltin}\""))) case m: MemoryLoadOp => val memVar = BMapVar("memory", MapBType(BitVecBType(m.addressSize), BitVecBType(m.valueSize)), Scope.Parameter) val indexVar = BParam("index", BitVecBType(m.addressSize)) @@ -112,7 +118,7 @@ class IRToBoogie(var program: Program, var spec: Specification) { BinaryBExpr(BVCONCAT, next, concat) } - BFunction(m.fnName, "", in, out, Some(body)) + BFunction(m.fnName, in, out, Some(body), List(externAttr)) case g: GammaLoadOp => val gammaMapVar = BMapVar("gammaMap", MapBType(BitVecBType(g.addressSize), BoolBType), Scope.Parameter) val indexVar = BParam("index", BitVecBType(g.addressSize)) @@ -130,7 +136,7 @@ class IRToBoogie(var program: Program, var spec: Specification) { BinaryBExpr(BoolAND, next, and) } - BFunction(g.fnName, "", in, out, Some(body)) + BFunction(g.fnName, in, out, Some(body), List(externAttr)) case m: MemoryStoreOp => val memType = MapBType(BitVecBType(m.addressSize), BitVecBType(m.valueSize)) val memVar = BMapVar("memory", memType, Scope.Parameter) @@ -160,7 +166,7 @@ class IRToBoogie(var program: Program, var spec: Specification) { (update: MapUpdate, next: (BExpr, BExpr)) => MapUpdate(update, next._1, next._2) } - BFunction(m.fnName, "", in, out, Some(body)) + BFunction(m.fnName, in, out, Some(body), List(externAttr)) case g: GammaStoreOp => val gammaMapType = MapBType(BitVecBType(g.addressSize), BoolBType) val gammaMapVar = BMapVar("gammaMap", gammaMapType, Scope.Parameter) @@ -187,7 +193,7 @@ class IRToBoogie(var program: Program, var spec: Specification) { (update: MapUpdate, next: (BExpr, BExpr)) => MapUpdate(update, next._1, next._2) } - BFunction(g.fnName, "", in, out, Some(body)) + BFunction(g.fnName, in, out, Some(body), List(externAttr)) case l: LOp => val memoryVar = BParam("memory", l.memoryType) val indexVar = BParam("index", l.indexType) @@ -213,7 +219,7 @@ class IRToBoogie(var program: Program, var spec: Specification) { IfThenElse(guard, LPred, ite) } } - BFunction("L", "", List(memoryVar, indexVar), BParam(BoolBType), Some(body)) + BFunction("L", List(memoryVar, indexVar), BParam(BoolBType), Some(body), List(externAttr)) } } @@ -288,7 +294,8 @@ class IRToBoogie(var program: Program, var spec: Specification) { freeEnsures, freeRequires, modifies.toSet, - body.toList + body.toList, + List.empty ) } diff --git a/src/test/correct/arrays_simple/clang/arrays_simple.expected b/src/test/correct/arrays_simple/clang/arrays_simple.expected index b326ff7ab..da968d58d 100644 --- a/src/test/correct/arrays_simple/clang/arrays_simple.expected +++ b/src/test/correct/arrays_simple/clang/arrays_simple.expected @@ -1,38 +1,38 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1872bv64); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1872bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,12 +82,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/correct/arrays_simple/clang_O2/arrays_simple.expected b/src/test/correct/arrays_simple/clang_O2/arrays_simple.expected index 1e9764f80..5f6aef7e1 100644 --- a/src/test/correct/arrays_simple/clang_O2/arrays_simple.expected +++ b/src/test/correct/arrays_simple/clang_O2/arrays_simple.expected @@ -1,14 +1,14 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var mem: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1840bv64); -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1840bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/correct/arrays_simple/clang_no_plt_no_pic/arrays_simple.expected b/src/test/correct/arrays_simple/clang_no_plt_no_pic/arrays_simple.expected index b326ff7ab..da968d58d 100644 --- a/src/test/correct/arrays_simple/clang_no_plt_no_pic/arrays_simple.expected +++ b/src/test/correct/arrays_simple/clang_no_plt_no_pic/arrays_simple.expected @@ -1,38 +1,38 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1872bv64); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1872bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,12 +82,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/correct/arrays_simple/clang_pic/arrays_simple.expected b/src/test/correct/arrays_simple/clang_pic/arrays_simple.expected index b326ff7ab..da968d58d 100644 --- a/src/test/correct/arrays_simple/clang_pic/arrays_simple.expected +++ b/src/test/correct/arrays_simple/clang_pic/arrays_simple.expected @@ -1,38 +1,38 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1872bv64); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1872bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,12 +82,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/correct/arrays_simple/gcc_O2/arrays_simple.expected b/src/test/correct/arrays_simple/gcc_O2/arrays_simple.expected index ab48890b6..2eddd390b 100644 --- a/src/test/correct/arrays_simple/gcc_O2/arrays_simple.expected +++ b/src/test/correct/arrays_simple/gcc_O2/arrays_simple.expected @@ -1,14 +1,14 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var mem: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1896bv64); -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1896bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/basic_arrays_read/clang/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/clang/basic_arrays_read.expected index f523388ae..9347c6ceb 100644 --- a/src/test/correct/basic_arrays_read/clang/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/clang/basic_arrays_read.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $arr_addr: bv64; -axiom ($arr_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom {:extern } ($arr_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -77,7 +77,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -85,18 +85,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert true; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/correct/basic_arrays_read/clang_O2/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/clang_O2/basic_arrays_read.expected index 3fc4ae2e9..f1be1b70e 100644 --- a/src/test/correct/basic_arrays_read/clang_O2/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/clang_O2/basic_arrays_read.expected @@ -1,33 +1,33 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var mem: [bv64]bv8; -const $arr_addr: bv64; -axiom ($arr_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom {:extern } ($arr_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -68,7 +68,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -76,18 +76,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert true; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_mem, R0, R8, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/correct/basic_arrays_read/clang_no_plt_no_pic/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/clang_no_plt_no_pic/basic_arrays_read.expected index f523388ae..9347c6ceb 100644 --- a/src/test/correct/basic_arrays_read/clang_no_plt_no_pic/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/clang_no_plt_no_pic/basic_arrays_read.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $arr_addr: bv64; -axiom ($arr_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom {:extern } ($arr_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -77,7 +77,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -85,18 +85,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert true; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/correct/basic_arrays_read/clang_pic/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/clang_pic/basic_arrays_read.expected index bcd1f7a82..d4caa02b2 100644 --- a/src/test/correct/basic_arrays_read/clang_pic/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/clang_pic/basic_arrays_read.expected @@ -1,50 +1,50 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $arr_addr: bv64; -axiom ($arr_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom {:extern } ($arr_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -93,7 +93,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -101,18 +101,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert true; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/correct/basic_arrays_read/gcc/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/gcc/basic_arrays_read.expected index d8e31fe22..bc637e63a 100644 --- a/src/test/correct/basic_arrays_read/gcc/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/gcc/basic_arrays_read.expected @@ -1,36 +1,36 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var mem: [bv64]bv8; -const $arr_addr: bv64; -axiom ($arr_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom {:extern } ($arr_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -71,7 +71,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -79,18 +79,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert true; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_mem, R0, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/basic_arrays_read/gcc_O2/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/gcc_O2/basic_arrays_read.expected index 6667be099..562f1d5eb 100644 --- a/src/test/correct/basic_arrays_read/gcc_O2/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/gcc_O2/basic_arrays_read.expected @@ -1,33 +1,33 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $arr_addr: bv64; -axiom ($arr_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom {:extern } ($arr_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -68,7 +68,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -76,18 +76,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert true; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/basic_arrays_read/gcc_no_plt_no_pic/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/gcc_no_plt_no_pic/basic_arrays_read.expected index d8e31fe22..bc637e63a 100644 --- a/src/test/correct/basic_arrays_read/gcc_no_plt_no_pic/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/gcc_no_plt_no_pic/basic_arrays_read.expected @@ -1,36 +1,36 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var mem: [bv64]bv8; -const $arr_addr: bv64; -axiom ($arr_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom {:extern } ($arr_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -71,7 +71,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -79,18 +79,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert true; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_mem, R0, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/basic_arrays_read/gcc_pic/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/gcc_pic/basic_arrays_read.expected index c12d5f8d6..dfb325d26 100644 --- a/src/test/correct/basic_arrays_read/gcc_pic/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/gcc_pic/basic_arrays_read.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var mem: [bv64]bv8; -const $arr_addr: bv64; -axiom ($arr_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom {:extern } ($arr_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -87,7 +87,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -95,18 +95,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert true; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_mem, R0, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/basic_arrays_write/clang/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/clang/basic_arrays_write.expected index 3e572c0c8..fae95e38d 100644 --- a/src/test/correct/basic_arrays_write/clang/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/clang/basic_arrays_write.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $arr_addr: bv64; -axiom ($arr_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom {:extern } ($arr_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -87,18 +87,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert true; } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -192,7 +192,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var arr$0_old: bv32; + var arr$0_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R9, Gamma_R9 := 69632bv64, true; diff --git a/src/test/correct/basic_arrays_write/clang_O2/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/clang_O2/basic_arrays_write.expected index 1715c0443..053d7afc8 100644 --- a/src/test/correct/basic_arrays_write/clang_O2/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/clang_O2/basic_arrays_write.expected @@ -1,36 +1,36 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $arr_addr: bv64; -axiom ($arr_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom {:extern } ($arr_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -71,7 +71,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -79,18 +79,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert true; } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var arr$0_old: bv32; + var arr$0_old: bv32; lmain: R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; R9, Gamma_R9 := 69632bv64, true; diff --git a/src/test/correct/basic_arrays_write/clang_no_plt_no_pic/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/clang_no_plt_no_pic/basic_arrays_write.expected index 3e572c0c8..fae95e38d 100644 --- a/src/test/correct/basic_arrays_write/clang_no_plt_no_pic/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/clang_no_plt_no_pic/basic_arrays_write.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $arr_addr: bv64; -axiom ($arr_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom {:extern } ($arr_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -87,18 +87,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert true; } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -192,7 +192,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var arr$0_old: bv32; + var arr$0_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R9, Gamma_R9 := 69632bv64, true; diff --git a/src/test/correct/basic_arrays_write/clang_pic/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/clang_pic/basic_arrays_write.expected index b3f87be66..f99da0575 100644 --- a/src/test/correct/basic_arrays_write/clang_pic/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/clang_pic/basic_arrays_write.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $arr_addr: bv64; -axiom ($arr_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom {:extern } ($arr_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -95,7 +95,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -103,18 +103,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert true; } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -224,7 +224,7 @@ procedure main() free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { - var arr$0_old: bv32; + var arr$0_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R9, Gamma_R9 := 65536bv64, true; diff --git a/src/test/correct/basic_arrays_write/gcc/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/gcc/basic_arrays_write.expected index 92f0905a8..21eaf4606 100644 --- a/src/test/correct/basic_arrays_write/gcc/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/gcc/basic_arrays_write.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $arr_addr: bv64; -axiom ($arr_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom {:extern } ($arr_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -77,7 +77,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -85,18 +85,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert true; } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -190,7 +190,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var arr$0_old: bv32; + var arr$0_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/correct/basic_arrays_write/gcc_O2/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/gcc_O2/basic_arrays_write.expected index d623aa766..fe91e2770 100644 --- a/src/test/correct/basic_arrays_write/gcc_O2/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/gcc_O2/basic_arrays_write.expected @@ -1,36 +1,36 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var mem: [bv64]bv8; -const $arr_addr: bv64; -axiom ($arr_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom {:extern } ($arr_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -71,7 +71,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -79,18 +79,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert true; } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var arr$0_old: bv32; + var arr$0_old: bv32; lmain: R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := zero_extend32_32(R0[32:0]), Gamma_R0; diff --git a/src/test/correct/basic_arrays_write/gcc_no_plt_no_pic/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/gcc_no_plt_no_pic/basic_arrays_write.expected index 92f0905a8..21eaf4606 100644 --- a/src/test/correct/basic_arrays_write/gcc_no_plt_no_pic/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/gcc_no_plt_no_pic/basic_arrays_write.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $arr_addr: bv64; -axiom ($arr_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom {:extern } ($arr_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -77,7 +77,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -85,18 +85,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert true; } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -190,7 +190,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var arr$0_old: bv32; + var arr$0_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/correct/basic_arrays_write/gcc_pic/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/gcc_pic/basic_arrays_write.expected index 646f49745..63d50027c 100644 --- a/src/test/correct/basic_arrays_write/gcc_pic/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/gcc_pic/basic_arrays_write.expected @@ -1,50 +1,50 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $arr_addr: bv64; -axiom ($arr_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom {:extern } ($arr_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -93,7 +93,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -101,18 +101,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert true; } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -222,7 +222,7 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var arr$0_old: bv32; + var arr$0_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/correct/basic_assign_assign/clang/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/clang/basic_assign_assign.expected index a64e855b7..333197eb0 100644 --- a/src/test/correct/basic_assign_assign/clang/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/clang/basic_assign_assign.expected @@ -1,35 +1,35 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -70,7 +70,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -78,18 +78,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 5bv64, true; diff --git a/src/test/correct/basic_assign_assign/clang_O2/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/clang_O2/basic_assign_assign.expected index ce931bc4a..1f4ed84a3 100644 --- a/src/test/correct/basic_assign_assign/clang_O2/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/clang_O2/basic_assign_assign.expected @@ -1,35 +1,35 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -70,7 +70,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -78,18 +78,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 5bv64, true; diff --git a/src/test/correct/basic_assign_assign/clang_no_plt_no_pic/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/clang_no_plt_no_pic/basic_assign_assign.expected index a64e855b7..333197eb0 100644 --- a/src/test/correct/basic_assign_assign/clang_no_plt_no_pic/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/clang_no_plt_no_pic/basic_assign_assign.expected @@ -1,35 +1,35 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -70,7 +70,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -78,18 +78,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 5bv64, true; diff --git a/src/test/correct/basic_assign_assign/clang_pic/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/clang_pic/basic_assign_assign.expected index cee149132..bb6b5b6bf 100644 --- a/src/test/correct/basic_assign_assign/clang_pic/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/clang_pic/basic_assign_assign.expected @@ -1,43 +1,43 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -86,7 +86,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -94,18 +94,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -214,7 +214,7 @@ procedure main() free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R9, Gamma_R9 := 65536bv64, true; call rely(); diff --git a/src/test/correct/basic_assign_assign/gcc/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/gcc/basic_assign_assign.expected index 08e4296f3..d57bc1507 100644 --- a/src/test/correct/basic_assign_assign/gcc/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/gcc/basic_assign_assign.expected @@ -1,33 +1,33 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -68,7 +68,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -76,18 +76,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -180,7 +180,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/basic_assign_assign/gcc_O2/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/gcc_O2/basic_assign_assign.expected index cc8b3eeb2..c90bb3830 100644 --- a/src/test/correct/basic_assign_assign/gcc_O2/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/gcc_O2/basic_assign_assign.expected @@ -1,35 +1,35 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -70,7 +70,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -78,18 +78,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 5bv64, true; diff --git a/src/test/correct/basic_assign_assign/gcc_no_plt_no_pic/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/gcc_no_plt_no_pic/basic_assign_assign.expected index 08e4296f3..d57bc1507 100644 --- a/src/test/correct/basic_assign_assign/gcc_no_plt_no_pic/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/gcc_no_plt_no_pic/basic_assign_assign.expected @@ -1,33 +1,33 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -68,7 +68,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -76,18 +76,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -180,7 +180,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/basic_assign_assign/gcc_pic/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/gcc_pic/basic_assign_assign.expected index 85246be43..2b6a307e2 100644 --- a/src/test/correct/basic_assign_assign/gcc_pic/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/gcc_pic/basic_assign_assign.expected @@ -1,41 +1,41 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -84,7 +84,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -92,18 +92,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -212,7 +212,7 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R0, Gamma_R0 := 65536bv64, true; call rely(); diff --git a/src/test/correct/basic_assign_increment/clang/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/clang/basic_assign_increment.expected index 36312a51e..3a38a4e20 100644 --- a/src/test/correct/basic_assign_increment/clang/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/clang/basic_assign_increment.expected @@ -1,41 +1,41 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -76,7 +76,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -84,18 +84,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -188,7 +188,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R9, Gamma_R9 := 69632bv64, true; call rely(); diff --git a/src/test/correct/basic_assign_increment/clang_O2/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/clang_O2/basic_assign_increment.expected index 86b1b096d..f164f2fac 100644 --- a/src/test/correct/basic_assign_increment/clang_O2/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/clang_O2/basic_assign_increment.expected @@ -1,41 +1,41 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -76,7 +76,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -84,18 +84,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -188,7 +188,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R8, Gamma_R8 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/basic_assign_increment/clang_no_plt_no_pic/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/clang_no_plt_no_pic/basic_assign_increment.expected index 36312a51e..3a38a4e20 100644 --- a/src/test/correct/basic_assign_increment/clang_no_plt_no_pic/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/clang_no_plt_no_pic/basic_assign_increment.expected @@ -1,41 +1,41 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -76,7 +76,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -84,18 +84,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -188,7 +188,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R9, Gamma_R9 := 69632bv64, true; call rely(); diff --git a/src/test/correct/basic_assign_increment/clang_pic/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/clang_pic/basic_assign_increment.expected index 4cd66a8c8..7e81511d4 100644 --- a/src/test/correct/basic_assign_increment/clang_pic/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/clang_pic/basic_assign_increment.expected @@ -1,49 +1,49 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -92,7 +92,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -100,18 +100,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -220,7 +220,7 @@ procedure main() free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R9, Gamma_R9 := 65536bv64, true; call rely(); diff --git a/src/test/correct/basic_assign_increment/gcc/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/gcc/basic_assign_increment.expected index 3d153e01b..91e00fe99 100644 --- a/src/test/correct/basic_assign_increment/gcc/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/gcc/basic_assign_increment.expected @@ -1,39 +1,39 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -74,7 +74,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -82,18 +82,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -186,7 +186,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/basic_assign_increment/gcc_O2/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/gcc_O2/basic_assign_increment.expected index 9c5f79584..071eff3fe 100644 --- a/src/test/correct/basic_assign_increment/gcc_O2/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/gcc_O2/basic_assign_increment.expected @@ -1,41 +1,41 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -76,7 +76,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -84,18 +84,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -188,7 +188,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R2, Gamma_R2 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/basic_assign_increment/gcc_no_plt_no_pic/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/gcc_no_plt_no_pic/basic_assign_increment.expected index 3d153e01b..91e00fe99 100644 --- a/src/test/correct/basic_assign_increment/gcc_no_plt_no_pic/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/gcc_no_plt_no_pic/basic_assign_increment.expected @@ -1,39 +1,39 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -74,7 +74,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -82,18 +82,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -186,7 +186,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/basic_assign_increment/gcc_pic/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/gcc_pic/basic_assign_increment.expected index bcb6297df..2fc495085 100644 --- a/src/test/correct/basic_assign_increment/gcc_pic/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/gcc_pic/basic_assign_increment.expected @@ -1,47 +1,47 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -90,7 +90,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -98,18 +98,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -218,7 +218,7 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R0, Gamma_R0 := 65536bv64, true; call rely(); diff --git a/src/test/correct/basic_function_call_caller/clang/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/clang/basic_function_call_caller.expected index 60a7c6f30..227e1ffa9 100644 --- a/src/test/correct/basic_function_call_caller/clang/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/clang/basic_function_call_caller.expected @@ -1,66 +1,66 @@ -var Gamma_R0: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $y_addr: bv64; -axiom ($y_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -102,7 +102,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -111,20 +111,20 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R29, R30, R31, R8, R9, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -220,12 +220,12 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_y_old: bool; - var x_old: bv32; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_y_old: bool; + var x_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; @@ -264,7 +264,7 @@ procedure main() return; } -procedure zero() +procedure zero() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1896bv64) == 1bv8); free requires (memory_load8_le(mem, 1897bv64) == 0bv8); diff --git a/src/test/correct/basic_function_call_caller/clang_O2/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/clang_O2/basic_function_call_caller.expected index 8f23c33b3..07bfa8d6c 100644 --- a/src/test/correct/basic_function_call_caller/clang_O2/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/clang_O2/basic_function_call_caller.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $y_addr: bv64; -axiom ($y_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -80,7 +80,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -89,20 +89,20 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R8, R9, mem; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -194,8 +194,8 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_y_old: bool; - var x_old: bv32; + var Gamma_y_old: bool; + var x_old: bv32; lmain: R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/basic_function_call_caller/clang_no_plt_no_pic/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/clang_no_plt_no_pic/basic_function_call_caller.expected index 2da604ae7..b9313f306 100644 --- a/src/test/correct/basic_function_call_caller/clang_no_plt_no_pic/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/clang_no_plt_no_pic/basic_function_call_caller.expected @@ -1,66 +1,66 @@ -var Gamma_R0: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $y_addr: bv64; -axiom ($y_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -102,7 +102,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -111,20 +111,20 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R29, R30, R31, R8, R9, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -220,12 +220,12 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_y_old: bool; - var x_old: bv32; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_y_old: bool; + var x_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; @@ -264,7 +264,7 @@ procedure main() return; } -procedure zero() +procedure zero() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1896bv64) == 1bv8); free requires (memory_load8_le(mem, 1897bv64) == 0bv8); diff --git a/src/test/correct/basic_function_call_caller/clang_pic/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/clang_pic/basic_function_call_caller.expected index 85ae403cc..46d4e2f30 100644 --- a/src/test/correct/basic_function_call_caller/clang_pic/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/clang_pic/basic_function_call_caller.expected @@ -1,66 +1,66 @@ -var Gamma_R0: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $y_addr: bv64; -axiom ($y_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -118,7 +118,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -127,20 +127,20 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R29, R30, R31, R8, R9, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -268,12 +268,12 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_y_old: bool; - var x_old: bv32; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_y_old: bool; + var x_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; @@ -316,7 +316,7 @@ procedure main() return; } -procedure zero() +procedure zero() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1968bv64) == 1bv8); free requires (memory_load8_le(mem, 1969bv64) == 0bv8); diff --git a/src/test/correct/basic_function_call_caller/gcc/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/gcc/basic_function_call_caller.expected index a129dc430..278aee3f4 100644 --- a/src/test/correct/basic_function_call_caller/gcc/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/gcc/basic_function_call_caller.expected @@ -1,64 +1,64 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -100,7 +100,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -109,20 +109,20 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -218,10 +218,10 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; - var Gamma_y_old: bool; - var x_old: bv32; + var #4: bv64; + var Gamma_#4: bool; + var Gamma_y_old: bool; + var x_old: bv32; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -262,7 +262,7 @@ procedure main() return; } -procedure zero() +procedure zero() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1900bv64) == 1bv8); free requires (memory_load8_le(mem, 1901bv64) == 0bv8); diff --git a/src/test/correct/basic_function_call_caller/gcc_O2/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/gcc_O2/basic_function_call_caller.expected index 338a6d32c..680f6b812 100644 --- a/src/test/correct/basic_function_call_caller/gcc_O2/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/gcc_O2/basic_function_call_caller.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_R3: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var R3: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R3: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R3: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -80,7 +80,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -89,20 +89,20 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R3, Gamma_mem, R0, R1, R2, R3, mem; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -194,8 +194,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_y_old: bool; - var x_old: bv32; + var Gamma_y_old: bool; + var x_old: bv32; lmain: R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; diff --git a/src/test/correct/basic_function_call_caller/gcc_no_plt_no_pic/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/gcc_no_plt_no_pic/basic_function_call_caller.expected index 86bac1f17..a9d652d5f 100644 --- a/src/test/correct/basic_function_call_caller/gcc_no_plt_no_pic/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/gcc_no_plt_no_pic/basic_function_call_caller.expected @@ -1,64 +1,64 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -100,7 +100,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -109,20 +109,20 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -218,10 +218,10 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; - var Gamma_y_old: bool; - var x_old: bv32; + var #4: bv64; + var Gamma_#4: bool; + var Gamma_y_old: bool; + var x_old: bv32; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -262,7 +262,7 @@ procedure main() return; } -procedure zero() +procedure zero() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1900bv64) == 1bv8); free requires (memory_load8_le(mem, 1901bv64) == 0bv8); diff --git a/src/test/correct/basic_function_call_caller/gcc_pic/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/gcc_pic/basic_function_call_caller.expected index 062aa71c0..88ee802ac 100644 --- a/src/test/correct/basic_function_call_caller/gcc_pic/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/gcc_pic/basic_function_call_caller.expected @@ -1,64 +1,64 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -116,7 +116,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -125,20 +125,20 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -266,10 +266,10 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; - var Gamma_y_old: bool; - var x_old: bv32; + var #4: bv64; + var Gamma_#4: bool; + var Gamma_y_old: bool; + var x_old: bv32; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -312,7 +312,7 @@ procedure main() return; } -procedure zero() +procedure zero() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1964bv64) == 1bv8); free requires (memory_load8_le(mem, 1965bv64) == 0bv8); diff --git a/src/test/correct/basic_function_call_reader/clang/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/clang/basic_function_call_reader.expected index 23ab29004..2ca124372 100644 --- a/src/test/correct/basic_function_call_reader/clang/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/clang/basic_function_call_reader.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $y_addr: bv64; -axiom ($y_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -88,7 +88,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -97,20 +97,20 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -203,16 +203,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/basic_function_call_reader/clang_O2/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/clang_O2/basic_function_call_reader.expected index 7987ac443..d1bccd69c 100644 --- a/src/test/correct/basic_function_call_reader/clang_O2/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/clang_O2/basic_function_call_reader.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $y_addr: bv64; -axiom ($y_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -78,7 +78,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -87,20 +87,20 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -191,16 +191,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; diff --git a/src/test/correct/basic_function_call_reader/clang_no_plt_no_pic/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/clang_no_plt_no_pic/basic_function_call_reader.expected index 66a7c15e5..402cd9af2 100644 --- a/src/test/correct/basic_function_call_reader/clang_no_plt_no_pic/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/clang_no_plt_no_pic/basic_function_call_reader.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $y_addr: bv64; -axiom ($y_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -88,7 +88,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -97,20 +97,20 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -203,16 +203,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/basic_function_call_reader/clang_pic/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/clang_pic/basic_function_call_reader.expected index f0f9dd71e..da79410ad 100644 --- a/src/test/correct/basic_function_call_reader/clang_pic/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/clang_pic/basic_function_call_reader.expected @@ -1,60 +1,60 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $y_addr: bv64; -axiom ($y_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -112,7 +112,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -121,20 +121,20 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -259,16 +259,16 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/basic_function_call_reader/gcc/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/gcc/basic_function_call_reader.expected index 6082bfc1b..a60cd0066 100644 --- a/src/test/correct/basic_function_call_reader/gcc/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/gcc/basic_function_call_reader.expected @@ -1,50 +1,50 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -86,7 +86,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -95,20 +95,20 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -201,16 +201,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; diff --git a/src/test/correct/basic_function_call_reader/gcc_O2/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/gcc_O2/basic_function_call_reader.expected index 5d09ae024..827481efc 100644 --- a/src/test/correct/basic_function_call_reader/gcc_O2/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/gcc_O2/basic_function_call_reader.expected @@ -1,33 +1,33 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -69,7 +69,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -78,20 +78,20 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/basic_function_call_reader/gcc_no_plt_no_pic/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/gcc_no_plt_no_pic/basic_function_call_reader.expected index 1fb48bb01..5d4078242 100644 --- a/src/test/correct/basic_function_call_reader/gcc_no_plt_no_pic/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/gcc_no_plt_no_pic/basic_function_call_reader.expected @@ -1,50 +1,50 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -86,7 +86,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -95,20 +95,20 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -201,16 +201,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; diff --git a/src/test/correct/basic_function_call_reader/gcc_pic/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/gcc_pic/basic_function_call_reader.expected index 581270f2d..23420a907 100644 --- a/src/test/correct/basic_function_call_reader/gcc_pic/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/gcc_pic/basic_function_call_reader.expected @@ -1,58 +1,58 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -110,7 +110,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -119,20 +119,20 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -257,16 +257,16 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 65536bv64, true; diff --git a/src/test/correct/basic_lock_read/clang/basic_lock_read.expected b/src/test/correct/basic_lock_read/clang/basic_lock_read.expected index 48587af8a..8c7429171 100644 --- a/src/test/correct/basic_lock_read/clang/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/clang/basic_lock_read.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -87,7 +87,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -95,18 +95,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -200,17 +200,17 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; - var z_old: bv32; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; + var z_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/basic_lock_read/clang_O2/basic_lock_read.expected b/src/test/correct/basic_lock_read/clang_O2/basic_lock_read.expected index ec5eb6ff0..766186715 100644 --- a/src/test/correct/basic_lock_read/clang_O2/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/clang_O2/basic_lock_read.expected @@ -1,41 +1,41 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -76,7 +76,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -84,18 +84,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_mem, R0, R8, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -187,7 +187,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var z_old: bv32; + var z_old: bv32; lmain: R8, Gamma_R8 := 69632bv64, true; call rely(); diff --git a/src/test/correct/basic_lock_read/clang_no_plt_no_pic/basic_lock_read.expected b/src/test/correct/basic_lock_read/clang_no_plt_no_pic/basic_lock_read.expected index 4de731f00..c8bde52f3 100644 --- a/src/test/correct/basic_lock_read/clang_no_plt_no_pic/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/clang_no_plt_no_pic/basic_lock_read.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -87,7 +87,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -95,18 +95,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -200,17 +200,17 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; - var z_old: bv32; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; + var z_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/basic_lock_read/clang_pic/basic_lock_read.expected b/src/test/correct/basic_lock_read/clang_pic/basic_lock_read.expected index 9e4cd6a60..f14fdff0e 100644 --- a/src/test/correct/basic_lock_read/clang_pic/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/clang_pic/basic_lock_read.expected @@ -1,60 +1,60 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -111,7 +111,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -119,18 +119,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -256,17 +256,17 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; - var z_old: bv32; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; + var z_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/basic_lock_read/gcc/basic_lock_read.expected b/src/test/correct/basic_lock_read/gcc/basic_lock_read.expected index 40b7ea84d..617fd90e2 100644 --- a/src/test/correct/basic_lock_read/gcc/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/gcc/basic_lock_read.expected @@ -1,50 +1,50 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -85,7 +85,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -93,18 +93,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -198,17 +198,17 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; - var z_old: bv32; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; + var z_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/basic_lock_read/gcc_O2/basic_lock_read.expected b/src/test/correct/basic_lock_read/gcc_O2/basic_lock_read.expected index 783f51ff4..63f6b7e5f 100644 --- a/src/test/correct/basic_lock_read/gcc_O2/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/gcc_O2/basic_lock_read.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69656bv64); -const $z_addr: bv64; -axiom ($z_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69656bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -77,7 +77,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -85,18 +85,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -188,7 +188,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var z_old: bv32; + var z_old: bv32; lmain: R0, Gamma_R0 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/basic_lock_read/gcc_no_plt_no_pic/basic_lock_read.expected b/src/test/correct/basic_lock_read/gcc_no_plt_no_pic/basic_lock_read.expected index c5bb36bf7..cfaa71516 100644 --- a/src/test/correct/basic_lock_read/gcc_no_plt_no_pic/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/gcc_no_plt_no_pic/basic_lock_read.expected @@ -1,50 +1,50 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -85,7 +85,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -93,18 +93,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -198,17 +198,17 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; - var z_old: bv32; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; + var z_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/basic_lock_read/gcc_pic/basic_lock_read.expected b/src/test/correct/basic_lock_read/gcc_pic/basic_lock_read.expected index d1281a25c..0b39900de 100644 --- a/src/test/correct/basic_lock_read/gcc_pic/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/gcc_pic/basic_lock_read.expected @@ -1,58 +1,58 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -109,7 +109,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -117,18 +117,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -254,17 +254,17 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; - var z_old: bv32; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; + var z_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/basic_lock_security_read/clang/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/clang/basic_lock_security_read.expected index 054ff067d..c11b39962 100644 --- a/src/test/correct/basic_lock_security_read/clang/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/clang/basic_lock_security_read.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -87,7 +87,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -95,18 +95,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -199,16 +199,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/basic_lock_security_read/clang_O2/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/clang_O2/basic_lock_security_read.expected index 4b2120254..b1630aa80 100644 --- a/src/test/correct/basic_lock_security_read/clang_O2/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/clang_O2/basic_lock_security_read.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -77,7 +77,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -85,18 +85,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -187,16 +187,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; diff --git a/src/test/correct/basic_lock_security_read/clang_no_plt_no_pic/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/clang_no_plt_no_pic/basic_lock_security_read.expected index 2c9690283..8c9b50bd0 100644 --- a/src/test/correct/basic_lock_security_read/clang_no_plt_no_pic/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/clang_no_plt_no_pic/basic_lock_security_read.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -87,7 +87,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -95,18 +95,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -199,16 +199,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/basic_lock_security_read/clang_pic/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/clang_pic/basic_lock_security_read.expected index 7f918a986..9e341d77a 100644 --- a/src/test/correct/basic_lock_security_read/clang_pic/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/clang_pic/basic_lock_security_read.expected @@ -1,60 +1,60 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -111,7 +111,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -119,18 +119,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -255,16 +255,16 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/basic_lock_security_read/gcc/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/gcc/basic_lock_security_read.expected index 6c4e2abf7..ecdcf29f9 100644 --- a/src/test/correct/basic_lock_security_read/gcc/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/gcc/basic_lock_security_read.expected @@ -1,50 +1,50 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -85,7 +85,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -93,18 +93,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -197,16 +197,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/basic_lock_security_read/gcc_O2/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/gcc_O2/basic_lock_security_read.expected index c9e168021..1b6d448e7 100644 --- a/src/test/correct/basic_lock_security_read/gcc_O2/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/gcc_O2/basic_lock_security_read.expected @@ -1,36 +1,36 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69656bv64); -const $z_addr: bv64; -axiom ($z_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69656bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -71,7 +71,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -79,18 +79,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/basic_lock_security_read/gcc_no_plt_no_pic/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/gcc_no_plt_no_pic/basic_lock_security_read.expected index df22d1f47..d699a2582 100644 --- a/src/test/correct/basic_lock_security_read/gcc_no_plt_no_pic/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/gcc_no_plt_no_pic/basic_lock_security_read.expected @@ -1,50 +1,50 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -85,7 +85,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -93,18 +93,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -197,16 +197,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/basic_lock_security_read/gcc_pic/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/gcc_pic/basic_lock_security_read.expected index 15c247916..b91bc2beb 100644 --- a/src/test/correct/basic_lock_security_read/gcc_pic/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/gcc_pic/basic_lock_security_read.expected @@ -1,58 +1,58 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -109,7 +109,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -117,18 +117,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -253,16 +253,16 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/basic_lock_security_write/clang/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/clang/basic_lock_security_write.expected index 01ba754fc..cb151d6c3 100644 --- a/src/test/correct/basic_lock_security_write/clang/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/clang/basic_lock_security_write.expected @@ -1,48 +1,48 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -83,7 +83,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -91,18 +91,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; requires (memory_load32_le(mem, $z_addr) != 0bv32); requires (Gamma_R0 == false); @@ -197,9 +197,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; - var x_old: bv32; - var z_old: bv32; + var Gamma_x_old: bool; + var x_old: bv32; + var z_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/correct/basic_lock_security_write/clang_O2/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/clang_O2/basic_lock_security_write.expected index 9fa7b521a..107a1ada4 100644 --- a/src/test/correct/basic_lock_security_write/clang_O2/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/clang_O2/basic_lock_security_write.expected @@ -1,41 +1,41 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -76,7 +76,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -84,18 +84,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $z_addr) != 0bv32); requires (Gamma_R0 == false); @@ -188,9 +188,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; - var x_old: bv32; - var z_old: bv32; + var Gamma_x_old: bool; + var x_old: bv32; + var z_old: bv32; lmain: R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; diff --git a/src/test/correct/basic_lock_security_write/clang_no_plt_no_pic/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/clang_no_plt_no_pic/basic_lock_security_write.expected index 01ba754fc..cb151d6c3 100644 --- a/src/test/correct/basic_lock_security_write/clang_no_plt_no_pic/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/clang_no_plt_no_pic/basic_lock_security_write.expected @@ -1,48 +1,48 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -83,7 +83,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -91,18 +91,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; requires (memory_load32_le(mem, $z_addr) != 0bv32); requires (Gamma_R0 == false); @@ -197,9 +197,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; - var x_old: bv32; - var z_old: bv32; + var Gamma_x_old: bool; + var x_old: bv32; + var z_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/correct/basic_lock_security_write/clang_pic/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/clang_pic/basic_lock_security_write.expected index 3e954daf5..a420c2740 100644 --- a/src/test/correct/basic_lock_security_write/clang_pic/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/clang_pic/basic_lock_security_write.expected @@ -1,56 +1,56 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -107,7 +107,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -115,18 +115,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; requires (memory_load32_le(mem, $z_addr) != 0bv32); requires (Gamma_R0 == false); @@ -253,9 +253,9 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var Gamma_x_old: bool; - var x_old: bv32; - var z_old: bv32; + var Gamma_x_old: bool; + var x_old: bv32; + var z_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/correct/basic_lock_security_write/gcc/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/gcc/basic_lock_security_write.expected index 7de8b70b1..990e89dde 100644 --- a/src/test/correct/basic_lock_security_write/gcc/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/gcc/basic_lock_security_write.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -87,18 +87,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; requires (memory_load32_le(mem, $z_addr) != 0bv32); requires (Gamma_R0 == false); @@ -193,9 +193,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; - var x_old: bv32; - var z_old: bv32; + var Gamma_x_old: bool; + var x_old: bv32; + var z_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/correct/basic_lock_security_write/gcc_O2/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/gcc_O2/basic_lock_security_write.expected index bd0c54c4c..2e79d72cd 100644 --- a/src/test/correct/basic_lock_security_write/gcc_O2/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/gcc_O2/basic_lock_security_write.expected @@ -1,41 +1,41 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -76,7 +76,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -84,18 +84,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; requires (memory_load32_le(mem, $z_addr) != 0bv32); requires (Gamma_R0 == false); @@ -188,9 +188,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; - var x_old: bv32; - var z_old: bv32; + var Gamma_x_old: bool; + var x_old: bv32; + var z_old: bv32; lmain: R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; diff --git a/src/test/correct/basic_lock_security_write/gcc_no_plt_no_pic/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/gcc_no_plt_no_pic/basic_lock_security_write.expected index 7de8b70b1..990e89dde 100644 --- a/src/test/correct/basic_lock_security_write/gcc_no_plt_no_pic/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/gcc_no_plt_no_pic/basic_lock_security_write.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -87,18 +87,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; requires (memory_load32_le(mem, $z_addr) != 0bv32); requires (Gamma_R0 == false); @@ -193,9 +193,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; - var x_old: bv32; - var z_old: bv32; + var Gamma_x_old: bool; + var x_old: bv32; + var z_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/correct/basic_lock_security_write/gcc_pic/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/gcc_pic/basic_lock_security_write.expected index 059e8c88a..4c505d5c8 100644 --- a/src/test/correct/basic_lock_security_write/gcc_pic/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/gcc_pic/basic_lock_security_write.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -103,7 +103,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -111,18 +111,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; requires (memory_load32_le(mem, $z_addr) != 0bv32); requires (Gamma_R0 == false); @@ -249,9 +249,9 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var Gamma_x_old: bool; - var x_old: bv32; - var z_old: bv32; + var Gamma_x_old: bool; + var x_old: bv32; + var z_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/correct/basic_lock_unlock/clang/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/clang/basic_lock_unlock.expected index aec6e1318..cc507074a 100644 --- a/src/test/correct/basic_lock_unlock/clang/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/clang/basic_lock_unlock.expected @@ -1,37 +1,37 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -72,7 +72,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -80,18 +80,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $z_addr) == 1bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -183,8 +183,8 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; - var z_old: bv32; + var x_old: bv32; + var z_old: bv32; lmain: R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; diff --git a/src/test/correct/basic_lock_unlock/clang_O2/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/clang_O2/basic_lock_unlock.expected index 06cb29ce9..83635e876 100644 --- a/src/test/correct/basic_lock_unlock/clang_O2/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/clang_O2/basic_lock_unlock.expected @@ -1,39 +1,39 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -74,7 +74,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -82,18 +82,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R8, R9, mem; requires (memory_load32_le(mem, $z_addr) == 1bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -185,8 +185,8 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; - var z_old: bv32; + var x_old: bv32; + var z_old: bv32; lmain: R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; diff --git a/src/test/correct/basic_lock_unlock/clang_no_plt_no_pic/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/clang_no_plt_no_pic/basic_lock_unlock.expected index aec6e1318..cc507074a 100644 --- a/src/test/correct/basic_lock_unlock/clang_no_plt_no_pic/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/clang_no_plt_no_pic/basic_lock_unlock.expected @@ -1,37 +1,37 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -72,7 +72,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -80,18 +80,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $z_addr) == 1bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -183,8 +183,8 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; - var z_old: bv32; + var x_old: bv32; + var z_old: bv32; lmain: R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; diff --git a/src/test/correct/basic_lock_unlock/clang_pic/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/clang_pic/basic_lock_unlock.expected index f065d4569..102500723 100644 --- a/src/test/correct/basic_lock_unlock/clang_pic/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/clang_pic/basic_lock_unlock.expected @@ -1,45 +1,45 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -96,7 +96,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -104,18 +104,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $z_addr) == 1bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -239,8 +239,8 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var x_old: bv32; - var z_old: bv32; + var x_old: bv32; + var z_old: bv32; lmain: R9, Gamma_R9 := 65536bv64, true; call rely(); diff --git a/src/test/correct/basic_lock_unlock/gcc/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/gcc/basic_lock_unlock.expected index 0c3be857c..57014effc 100644 --- a/src/test/correct/basic_lock_unlock/gcc/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/gcc/basic_lock_unlock.expected @@ -1,35 +1,35 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -70,7 +70,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -78,18 +78,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $z_addr) == 1bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -181,8 +181,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; - var z_old: bv32; + var x_old: bv32; + var z_old: bv32; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/basic_lock_unlock/gcc_O2/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/gcc_O2/basic_lock_unlock.expected index 1d13517fe..9833f1173 100644 --- a/src/test/correct/basic_lock_unlock/gcc_O2/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/gcc_O2/basic_lock_unlock.expected @@ -1,39 +1,39 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_R3: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var R3: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R3: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R3: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -74,7 +74,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -82,18 +82,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R3, Gamma_mem, R0, R1, R2, R3, mem; requires (memory_load32_le(mem, $z_addr) == 1bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -185,8 +185,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; - var z_old: bv32; + var x_old: bv32; + var z_old: bv32; lmain: R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; diff --git a/src/test/correct/basic_lock_unlock/gcc_no_plt_no_pic/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/gcc_no_plt_no_pic/basic_lock_unlock.expected index 0c3be857c..57014effc 100644 --- a/src/test/correct/basic_lock_unlock/gcc_no_plt_no_pic/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/gcc_no_plt_no_pic/basic_lock_unlock.expected @@ -1,35 +1,35 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -70,7 +70,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -78,18 +78,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $z_addr) == 1bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -181,8 +181,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; - var z_old: bv32; + var x_old: bv32; + var z_old: bv32; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/basic_lock_unlock/gcc_pic/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/gcc_pic/basic_lock_unlock.expected index d5fdbac2c..4c09ab473 100644 --- a/src/test/correct/basic_lock_unlock/gcc_pic/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/gcc_pic/basic_lock_unlock.expected @@ -1,43 +1,43 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -94,7 +94,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -102,18 +102,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $z_addr) == 1bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -237,8 +237,8 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var x_old: bv32; - var z_old: bv32; + var x_old: bv32; + var z_old: bv32; lmain: R0, Gamma_R0 := 65536bv64, true; call rely(); diff --git a/src/test/correct/basic_loop_assign/clang/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/clang/basic_loop_assign.expected index 509e77e86..ccaa7b136 100644 --- a/src/test/correct/basic_loop_assign/clang/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/clang/basic_loop_assign.expected @@ -1,37 +1,37 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -72,7 +72,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -80,18 +80,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -184,7 +184,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 20bv64, true; diff --git a/src/test/correct/basic_loop_assign/clang_O2/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/clang_O2/basic_loop_assign.expected index 1321cd22f..2b8d4a303 100644 --- a/src/test/correct/basic_loop_assign/clang_O2/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/clang_O2/basic_loop_assign.expected @@ -1,37 +1,37 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -72,7 +72,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -80,18 +80,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -184,7 +184,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 20bv64, true; diff --git a/src/test/correct/basic_loop_assign/clang_no_plt_no_pic/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/clang_no_plt_no_pic/basic_loop_assign.expected index 509e77e86..ccaa7b136 100644 --- a/src/test/correct/basic_loop_assign/clang_no_plt_no_pic/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/clang_no_plt_no_pic/basic_loop_assign.expected @@ -1,37 +1,37 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -72,7 +72,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -80,18 +80,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -184,7 +184,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 20bv64, true; diff --git a/src/test/correct/basic_loop_assign/clang_pic/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/clang_pic/basic_loop_assign.expected index d0fa27046..f9c8066b1 100644 --- a/src/test/correct/basic_loop_assign/clang_pic/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/clang_pic/basic_loop_assign.expected @@ -1,45 +1,45 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -88,7 +88,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -96,18 +96,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -216,7 +216,7 @@ procedure main() free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R9, Gamma_R9 := 65536bv64, true; call rely(); diff --git a/src/test/correct/basic_loop_assign/gcc/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/gcc/basic_loop_assign.expected index d2e9ce4b6..96cc29efe 100644 --- a/src/test/correct/basic_loop_assign/gcc/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/gcc/basic_loop_assign.expected @@ -1,35 +1,35 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -70,7 +70,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -78,18 +78,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/basic_loop_assign/gcc_O2/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/gcc_O2/basic_loop_assign.expected index 3b9101b12..5780fc9d1 100644 --- a/src/test/correct/basic_loop_assign/gcc_O2/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/gcc_O2/basic_loop_assign.expected @@ -1,37 +1,37 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -72,7 +72,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -80,18 +80,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -184,7 +184,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 20bv64, true; diff --git a/src/test/correct/basic_loop_assign/gcc_no_plt_no_pic/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/gcc_no_plt_no_pic/basic_loop_assign.expected index d2e9ce4b6..96cc29efe 100644 --- a/src/test/correct/basic_loop_assign/gcc_no_plt_no_pic/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/gcc_no_plt_no_pic/basic_loop_assign.expected @@ -1,35 +1,35 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -70,7 +70,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -78,18 +78,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/basic_loop_assign/gcc_pic/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/gcc_pic/basic_loop_assign.expected index de1c11056..abdc8d4d2 100644 --- a/src/test/correct/basic_loop_assign/gcc_pic/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/gcc_pic/basic_loop_assign.expected @@ -1,43 +1,43 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -86,7 +86,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -94,18 +94,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -214,7 +214,7 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R0, Gamma_R0 := 65536bv64, true; call rely(); diff --git a/src/test/correct/basic_operation_evaluation/clang/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/clang/basic_operation_evaluation.expected index 68b3adfae..acb697510 100644 --- a/src/test/correct/basic_operation_evaluation/clang/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/clang/basic_operation_evaluation.expected @@ -1,64 +1,64 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R10: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R10: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1952bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); -function {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1952bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -99,7 +99,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -108,12 +108,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_stack, R0, R10, R31, R8, R9, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -206,18 +206,18 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; diff --git a/src/test/correct/basic_operation_evaluation/clang_O2/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/clang_O2/basic_operation_evaluation.expected index 1e9764f80..5f6aef7e1 100644 --- a/src/test/correct/basic_operation_evaluation/clang_O2/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/clang_O2/basic_operation_evaluation.expected @@ -1,14 +1,14 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var mem: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1840bv64); -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1840bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/correct/basic_operation_evaluation/clang_no_plt_no_pic/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/clang_no_plt_no_pic/basic_operation_evaluation.expected index 30009c38c..74e693475 100644 --- a/src/test/correct/basic_operation_evaluation/clang_no_plt_no_pic/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/clang_no_plt_no_pic/basic_operation_evaluation.expected @@ -1,64 +1,64 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R10: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R10: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1952bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); -function {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1952bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -99,7 +99,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -108,12 +108,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_stack, R0, R10, R31, R8, R9, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -206,18 +206,18 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; diff --git a/src/test/correct/basic_operation_evaluation/clang_pic/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/clang_pic/basic_operation_evaluation.expected index 30009c38c..74e693475 100644 --- a/src/test/correct/basic_operation_evaluation/clang_pic/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/clang_pic/basic_operation_evaluation.expected @@ -1,64 +1,64 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R10: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R10: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1952bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); -function {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1952bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -99,7 +99,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -108,12 +108,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_stack, R0, R10, R31, R8, R9, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -206,18 +206,18 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; diff --git a/src/test/correct/basic_operation_evaluation/gcc/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/gcc/basic_operation_evaluation.expected index 3d0958349..cce329b28 100644 --- a/src/test/correct/basic_operation_evaluation/gcc/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/gcc/basic_operation_evaluation.expected @@ -1,56 +1,56 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1948bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); -function {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1948bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,7 +91,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,12 +100,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R31, Gamma_stack, R0, R1, R2, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/basic_operation_evaluation/gcc_O2/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/gcc_O2/basic_operation_evaluation.expected index ab48890b6..2eddd390b 100644 --- a/src/test/correct/basic_operation_evaluation/gcc_O2/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/gcc_O2/basic_operation_evaluation.expected @@ -1,14 +1,14 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var mem: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1896bv64); -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1896bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/basic_operation_evaluation/gcc_no_plt_no_pic/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/gcc_no_plt_no_pic/basic_operation_evaluation.expected index 9612d9db9..a7b3105a5 100644 --- a/src/test/correct/basic_operation_evaluation/gcc_no_plt_no_pic/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/gcc_no_plt_no_pic/basic_operation_evaluation.expected @@ -1,56 +1,56 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1948bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); -function {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1948bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,7 +91,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,12 +100,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R31, Gamma_stack, R0, R1, R2, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/basic_operation_evaluation/gcc_pic/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/gcc_pic/basic_operation_evaluation.expected index 9612d9db9..a7b3105a5 100644 --- a/src/test/correct/basic_operation_evaluation/gcc_pic/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/gcc_pic/basic_operation_evaluation.expected @@ -1,56 +1,56 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1948bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); -function {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1948bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,7 +91,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,12 +100,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R31, Gamma_stack, R0, R1, R2, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/basic_sec_policy_read/clang/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/clang/basic_sec_policy_read.expected index 30140b76d..03ac930f1 100644 --- a/src/test/correct/basic_sec_policy_read/clang/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/clang/basic_sec_policy_read.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -87,7 +87,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -95,18 +95,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -199,16 +199,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/basic_sec_policy_read/clang_O2/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/clang_O2/basic_sec_policy_read.expected index 999923f6d..29b3fc3a6 100644 --- a/src/test/correct/basic_sec_policy_read/clang_O2/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/clang_O2/basic_sec_policy_read.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -77,7 +77,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -85,18 +85,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -187,16 +187,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; diff --git a/src/test/correct/basic_sec_policy_read/clang_no_plt_no_pic/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/clang_no_plt_no_pic/basic_sec_policy_read.expected index 5f935e465..f69ff2e02 100644 --- a/src/test/correct/basic_sec_policy_read/clang_no_plt_no_pic/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/clang_no_plt_no_pic/basic_sec_policy_read.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -87,7 +87,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -95,18 +95,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -199,16 +199,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/basic_sec_policy_read/clang_pic/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/clang_pic/basic_sec_policy_read.expected index f2d986215..2d81bb360 100644 --- a/src/test/correct/basic_sec_policy_read/clang_pic/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/clang_pic/basic_sec_policy_read.expected @@ -1,60 +1,60 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -111,7 +111,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -119,18 +119,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -255,16 +255,16 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/basic_sec_policy_read/gcc/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/gcc/basic_sec_policy_read.expected index 6bbc9f13c..64e3b051f 100644 --- a/src/test/correct/basic_sec_policy_read/gcc/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/gcc/basic_sec_policy_read.expected @@ -1,50 +1,50 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -85,7 +85,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -93,18 +93,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -197,16 +197,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; diff --git a/src/test/correct/basic_sec_policy_read/gcc_O2/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/gcc_O2/basic_sec_policy_read.expected index afd185b0e..edc69990e 100644 --- a/src/test/correct/basic_sec_policy_read/gcc_O2/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/gcc_O2/basic_sec_policy_read.expected @@ -1,36 +1,36 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69656bv64); -const $z_addr: bv64; -axiom ($z_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69656bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -71,7 +71,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -79,18 +79,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/basic_sec_policy_read/gcc_no_plt_no_pic/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/gcc_no_plt_no_pic/basic_sec_policy_read.expected index 9519b3247..3d899e3ba 100644 --- a/src/test/correct/basic_sec_policy_read/gcc_no_plt_no_pic/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/gcc_no_plt_no_pic/basic_sec_policy_read.expected @@ -1,50 +1,50 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -85,7 +85,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -93,18 +93,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -197,16 +197,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; diff --git a/src/test/correct/basic_sec_policy_read/gcc_pic/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/gcc_pic/basic_sec_policy_read.expected index cf41554ac..7e9a3e0b7 100644 --- a/src/test/correct/basic_sec_policy_read/gcc_pic/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/gcc_pic/basic_sec_policy_read.expected @@ -1,58 +1,58 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -109,7 +109,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -117,18 +117,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -253,16 +253,16 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 65536bv64, true; diff --git a/src/test/correct/basic_sec_policy_write/clang/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/clang/basic_sec_policy_write.expected index b76307c3e..c9c7872e0 100644 --- a/src/test/correct/basic_sec_policy_write/clang/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/clang/basic_sec_policy_write.expected @@ -1,48 +1,48 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -83,7 +83,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -91,18 +91,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -196,8 +196,8 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/correct/basic_sec_policy_write/clang_O2/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/clang_O2/basic_sec_policy_write.expected index e11ed4e91..f5c73a175 100644 --- a/src/test/correct/basic_sec_policy_write/clang_O2/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/clang_O2/basic_sec_policy_write.expected @@ -1,43 +1,43 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -78,7 +78,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -86,18 +86,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R8, R9, mem; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -189,8 +189,8 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; diff --git a/src/test/correct/basic_sec_policy_write/clang_no_plt_no_pic/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/clang_no_plt_no_pic/basic_sec_policy_write.expected index b76307c3e..c9c7872e0 100644 --- a/src/test/correct/basic_sec_policy_write/clang_no_plt_no_pic/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/clang_no_plt_no_pic/basic_sec_policy_write.expected @@ -1,48 +1,48 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -83,7 +83,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -91,18 +91,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -196,8 +196,8 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/correct/basic_sec_policy_write/clang_pic/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/clang_pic/basic_sec_policy_write.expected index e890cce75..d05390cf1 100644 --- a/src/test/correct/basic_sec_policy_write/clang_pic/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/clang_pic/basic_sec_policy_write.expected @@ -1,56 +1,56 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -107,7 +107,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -115,18 +115,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -252,8 +252,8 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/correct/basic_sec_policy_write/gcc/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/gcc/basic_sec_policy_write.expected index 66696d8c5..44cdf43c0 100644 --- a/src/test/correct/basic_sec_policy_write/gcc/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/gcc/basic_sec_policy_write.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -87,18 +87,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -192,8 +192,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/correct/basic_sec_policy_write/gcc_O2/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/gcc_O2/basic_sec_policy_write.expected index 10df92113..6a50e91d8 100644 --- a/src/test/correct/basic_sec_policy_write/gcc_O2/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/gcc_O2/basic_sec_policy_write.expected @@ -1,43 +1,43 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_R3: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var R3: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R3: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R3: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -78,7 +78,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -86,18 +86,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R3, Gamma_mem, R0, R1, R2, R3, mem; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -189,8 +189,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; diff --git a/src/test/correct/basic_sec_policy_write/gcc_no_plt_no_pic/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/gcc_no_plt_no_pic/basic_sec_policy_write.expected index 66696d8c5..44cdf43c0 100644 --- a/src/test/correct/basic_sec_policy_write/gcc_no_plt_no_pic/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/gcc_no_plt_no_pic/basic_sec_policy_write.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -87,18 +87,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -192,8 +192,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/correct/basic_sec_policy_write/gcc_pic/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/gcc_pic/basic_sec_policy_write.expected index 09c819a7c..79e7ed95c 100644 --- a/src/test/correct/basic_sec_policy_write/gcc_pic/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/gcc_pic/basic_sec_policy_write.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -103,7 +103,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -111,18 +111,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -248,8 +248,8 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/correct/basicassign_gamma0/clang/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/clang/basicassign_gamma0.expected index baee5b809..6b52453e1 100644 --- a/src/test/correct/basicassign_gamma0/clang/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/clang/basicassign_gamma0.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69684bv64); -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69684bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -77,7 +77,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -85,15 +85,15 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (gamma_load32(Gamma_mem, $secret_addr) == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); diff --git a/src/test/correct/basicassign_gamma0/clang_O2/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/clang_O2/basicassign_gamma0.expected index 6d0a174ca..3b4a59dd8 100644 --- a/src/test/correct/basicassign_gamma0/clang_O2/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/clang_O2/basicassign_gamma0.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69684bv64); -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69684bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -77,7 +77,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -85,15 +85,15 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (gamma_load32(Gamma_mem, $secret_addr) == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); diff --git a/src/test/correct/basicassign_gamma0/clang_no_plt_no_pic/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/clang_no_plt_no_pic/basicassign_gamma0.expected index baee5b809..6b52453e1 100644 --- a/src/test/correct/basicassign_gamma0/clang_no_plt_no_pic/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/clang_no_plt_no_pic/basicassign_gamma0.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69684bv64); -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69684bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -77,7 +77,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -85,15 +85,15 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (gamma_load32(Gamma_mem, $secret_addr) == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); diff --git a/src/test/correct/basicassign_gamma0/clang_pic/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/clang_pic/basicassign_gamma0.expected index 491b1c61f..2e697517a 100644 --- a/src/test/correct/basicassign_gamma0/clang_pic/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/clang_pic/basicassign_gamma0.expected @@ -1,50 +1,50 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69684bv64); -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69684bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -101,7 +101,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -109,15 +109,15 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (gamma_load32(Gamma_mem, $secret_addr) == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); diff --git a/src/test/correct/basicassign_gamma0/gcc/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/gcc/basicassign_gamma0.expected index fe708ccc7..9c0a66786 100644 --- a/src/test/correct/basicassign_gamma0/gcc/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/gcc/basicassign_gamma0.expected @@ -1,40 +1,40 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69656bv64); -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69656bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -75,7 +75,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -83,15 +83,15 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (gamma_load32(Gamma_mem, $secret_addr) == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); diff --git a/src/test/correct/basicassign_gamma0/gcc_O2/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/gcc_O2/basicassign_gamma0.expected index d6b06580d..4e28b6f94 100644 --- a/src/test/correct/basicassign_gamma0/gcc_O2/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/gcc_O2/basicassign_gamma0.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69656bv64); -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69656bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -77,7 +77,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -85,15 +85,15 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; requires (gamma_load32(Gamma_mem, $secret_addr) == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); diff --git a/src/test/correct/basicassign_gamma0/gcc_no_plt_no_pic/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/gcc_no_plt_no_pic/basicassign_gamma0.expected index fe708ccc7..9c0a66786 100644 --- a/src/test/correct/basicassign_gamma0/gcc_no_plt_no_pic/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/gcc_no_plt_no_pic/basicassign_gamma0.expected @@ -1,40 +1,40 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69656bv64); -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69656bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -75,7 +75,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -83,15 +83,15 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (gamma_load32(Gamma_mem, $secret_addr) == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); diff --git a/src/test/correct/basicassign_gamma0/gcc_pic/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/gcc_pic/basicassign_gamma0.expected index 705b6a46c..474c43ba6 100644 --- a/src/test/correct/basicassign_gamma0/gcc_pic/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/gcc_pic/basicassign_gamma0.expected @@ -1,48 +1,48 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69656bv64); -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69656bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -99,7 +99,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -107,15 +107,15 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (gamma_load32(Gamma_mem, $secret_addr) == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); diff --git a/src/test/correct/basicfree/clang/basicfree.expected b/src/test/correct/basicfree/clang/basicfree.expected index 12202cbfb..a746e3ad3 100644 --- a/src/test/correct/basicfree/clang/basicfree.expected +++ b/src/test/correct/basicfree/clang/basicfree.expected @@ -1,59 +1,59 @@ -var Gamma_R0: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2080bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2080bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,12 +103,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2080bv64) == 1bv8); free requires (memory_load8_le(mem, 2081bv64) == 0bv8); @@ -183,7 +183,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69680bv64) == 0bv8); free requires (memory_load8_le(mem, 69681bv64) == 0bv8); @@ -278,10 +278,10 @@ procedure main() free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; @@ -311,7 +311,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2080bv64) == 1bv8); free requires (memory_load8_le(mem, 2081bv64) == 0bv8); diff --git a/src/test/correct/basicfree/clang_O2/basicfree.expected b/src/test/correct/basicfree/clang_O2/basicfree.expected index 8637d2c74..91a00d7c9 100644 --- a/src/test/correct/basicfree/clang_O2/basicfree.expected +++ b/src/test/correct/basicfree/clang_O2/basicfree.expected @@ -1,12 +1,12 @@ -var Gamma_mem: [bv64]bool; -var mem: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1836bv64); -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1836bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -47,7 +47,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,12 +56,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); free requires (memory_load8_le(mem, 69666bv64) == 0bv8); diff --git a/src/test/correct/basicfree/clang_no_plt_no_pic/basicfree.expected b/src/test/correct/basicfree/clang_no_plt_no_pic/basicfree.expected index f78216dd1..d72c83d9e 100644 --- a/src/test/correct/basicfree/clang_no_plt_no_pic/basicfree.expected +++ b/src/test/correct/basicfree/clang_no_plt_no_pic/basicfree.expected @@ -1,59 +1,59 @@ -var Gamma_R0: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2080bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2080bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,12 +103,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2080bv64) == 1bv8); free requires (memory_load8_le(mem, 2081bv64) == 0bv8); @@ -183,7 +183,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69680bv64) == 0bv8); free requires (memory_load8_le(mem, 69681bv64) == 0bv8); @@ -278,10 +278,10 @@ procedure main() free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; @@ -311,7 +311,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2080bv64) == 1bv8); free requires (memory_load8_le(mem, 2081bv64) == 0bv8); diff --git a/src/test/correct/basicfree/clang_pic/basicfree.expected b/src/test/correct/basicfree/clang_pic/basicfree.expected index f78216dd1..d72c83d9e 100644 --- a/src/test/correct/basicfree/clang_pic/basicfree.expected +++ b/src/test/correct/basicfree/clang_pic/basicfree.expected @@ -1,59 +1,59 @@ -var Gamma_R0: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2080bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2080bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,12 +103,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2080bv64) == 1bv8); free requires (memory_load8_le(mem, 2081bv64) == 0bv8); @@ -183,7 +183,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69680bv64) == 0bv8); free requires (memory_load8_le(mem, 69681bv64) == 0bv8); @@ -278,10 +278,10 @@ procedure main() free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; @@ -311,7 +311,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2080bv64) == 1bv8); free requires (memory_load8_le(mem, 2081bv64) == 0bv8); diff --git a/src/test/correct/basicfree/gcc/basicfree.expected b/src/test/correct/basicfree/gcc/basicfree.expected index 200f0b0ab..40e612597 100644 --- a/src/test/correct/basicfree/gcc/basicfree.expected +++ b/src/test/correct/basicfree/gcc/basicfree.expected @@ -1,57 +1,57 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2076bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2076bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,12 +101,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2076bv64) == 1bv8); free requires (memory_load8_le(mem, 2077bv64) == 0bv8); @@ -181,7 +181,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -276,8 +276,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -306,7 +306,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2076bv64) == 1bv8); free requires (memory_load8_le(mem, 2077bv64) == 0bv8); diff --git a/src/test/correct/basicfree/gcc_O2/basicfree.expected b/src/test/correct/basicfree/gcc_O2/basicfree.expected index a86190f67..db9ab2b08 100644 --- a/src/test/correct/basicfree/gcc_O2/basicfree.expected +++ b/src/test/correct/basicfree/gcc_O2/basicfree.expected @@ -1,12 +1,12 @@ -var Gamma_mem: [bv64]bool; -var mem: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1896bv64); -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1896bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -47,7 +47,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,12 +56,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); free requires (memory_load8_le(mem, 69634bv64) == 0bv8); diff --git a/src/test/correct/basicfree/gcc_no_plt_no_pic/basicfree.expected b/src/test/correct/basicfree/gcc_no_plt_no_pic/basicfree.expected index d248004cb..2320876e3 100644 --- a/src/test/correct/basicfree/gcc_no_plt_no_pic/basicfree.expected +++ b/src/test/correct/basicfree/gcc_no_plt_no_pic/basicfree.expected @@ -1,57 +1,57 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2076bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2076bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,12 +101,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2076bv64) == 1bv8); free requires (memory_load8_le(mem, 2077bv64) == 0bv8); @@ -181,7 +181,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -276,8 +276,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -306,7 +306,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2076bv64) == 1bv8); free requires (memory_load8_le(mem, 2077bv64) == 0bv8); diff --git a/src/test/correct/basicfree/gcc_pic/basicfree.expected b/src/test/correct/basicfree/gcc_pic/basicfree.expected index d248004cb..2320876e3 100644 --- a/src/test/correct/basicfree/gcc_pic/basicfree.expected +++ b/src/test/correct/basicfree/gcc_pic/basicfree.expected @@ -1,57 +1,57 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2076bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2076bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,12 +101,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2076bv64) == 1bv8); free requires (memory_load8_le(mem, 2077bv64) == 0bv8); @@ -181,7 +181,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -276,8 +276,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -306,7 +306,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2076bv64) == 1bv8); free requires (memory_load8_le(mem, 2077bv64) == 0bv8); diff --git a/src/test/correct/cjump/clang/cjump.expected b/src/test/correct/cjump/clang/cjump.expected index a17542801..a9b2d44e6 100644 --- a/src/test/correct/cjump/clang/cjump.expected +++ b/src/test/correct/cjump/clang/cjump.expected @@ -1,54 +1,54 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $y_addr: bv64; -axiom ($y_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,12 +98,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == false); @@ -198,16 +198,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/cjump/clang_O2/cjump.expected b/src/test/correct/cjump/clang_O2/cjump.expected index 170c6ac8d..17c5bc302 100644 --- a/src/test/correct/cjump/clang_O2/cjump.expected +++ b/src/test/correct/cjump/clang_O2/cjump.expected @@ -1,41 +1,41 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R11: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R11: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $y_addr: bv64; -axiom ($y_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R11: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R11: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,12 +85,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R11, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R11, R8, R9, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == false); diff --git a/src/test/correct/cjump/clang_no_plt_no_pic/cjump.expected b/src/test/correct/cjump/clang_no_plt_no_pic/cjump.expected index f0d4e8e44..6a74e6739 100644 --- a/src/test/correct/cjump/clang_no_plt_no_pic/cjump.expected +++ b/src/test/correct/cjump/clang_no_plt_no_pic/cjump.expected @@ -1,54 +1,54 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $y_addr: bv64; -axiom ($y_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,12 +98,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == false); @@ -198,16 +198,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/cjump/clang_pic/cjump.expected b/src/test/correct/cjump/clang_pic/cjump.expected index f7afa4a8a..2cecafe8a 100644 --- a/src/test/correct/cjump/clang_pic/cjump.expected +++ b/src/test/correct/cjump/clang_pic/cjump.expected @@ -1,62 +1,62 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $y_addr: bv64; -axiom ($y_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -113,7 +113,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -122,12 +122,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == false); @@ -254,16 +254,16 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/cjump/gcc/cjump.expected b/src/test/correct/cjump/gcc/cjump.expected index 3cade154e..316087ea1 100644 --- a/src/test/correct/cjump/gcc/cjump.expected +++ b/src/test/correct/cjump/gcc/cjump.expected @@ -1,48 +1,48 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,7 +83,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,12 +92,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == false); @@ -190,16 +190,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/cjump/gcc_O2/cjump.expected b/src/test/correct/cjump/gcc_O2/cjump.expected index 5fb2db688..6a9e8da8f 100644 --- a/src/test/correct/cjump/gcc_O2/cjump.expected +++ b/src/test/correct/cjump/gcc_O2/cjump.expected @@ -1,39 +1,39 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_R3: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var R3: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R3: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R3: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -74,7 +74,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,12 +83,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R3, Gamma_mem, R0, R1, R2, R3, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == false); diff --git a/src/test/correct/cjump/gcc_no_plt_no_pic/cjump.expected b/src/test/correct/cjump/gcc_no_plt_no_pic/cjump.expected index 9cb62b9bb..ef72c2e18 100644 --- a/src/test/correct/cjump/gcc_no_plt_no_pic/cjump.expected +++ b/src/test/correct/cjump/gcc_no_plt_no_pic/cjump.expected @@ -1,48 +1,48 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,7 +83,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,12 +92,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == false); @@ -190,16 +190,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/cjump/gcc_pic/cjump.expected b/src/test/correct/cjump/gcc_pic/cjump.expected index 54c34667c..0c0297b3a 100644 --- a/src/test/correct/cjump/gcc_pic/cjump.expected +++ b/src/test/correct/cjump/gcc_pic/cjump.expected @@ -1,56 +1,56 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -107,7 +107,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -116,12 +116,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == false); @@ -246,16 +246,16 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R0, Gamma_R0 := 65536bv64, true; call rely(); diff --git a/src/test/correct/function/clang/function.expected b/src/test/correct/function/clang/function.expected index c61514f51..1d34f0bb2 100644 --- a/src/test/correct/function/clang/function.expected +++ b/src/test/correct/function/clang/function.expected @@ -1,61 +1,61 @@ -var Gamma_R0: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $y_addr: bv64; -axiom ($y_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,7 +96,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -105,12 +105,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1884bv64) == 1bv8); free requires (memory_load8_le(mem, 1885bv64) == 0bv8); @@ -191,7 +191,7 @@ procedure get_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R29, R30, R31, R8, R9, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == true); @@ -288,8 +288,8 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); diff --git a/src/test/correct/function/clang_O2/function.expected b/src/test/correct/function/clang_O2/function.expected index 9303fc01f..43deb54a7 100644 --- a/src/test/correct/function/clang_O2/function.expected +++ b/src/test/correct/function/clang_O2/function.expected @@ -1,41 +1,41 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R11: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R11: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $y_addr: bv64; -axiom ($y_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R11: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R11: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,12 +85,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R11, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R11, R8, R9, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == true); diff --git a/src/test/correct/function/clang_no_plt_no_pic/function.expected b/src/test/correct/function/clang_no_plt_no_pic/function.expected index c61514f51..1d34f0bb2 100644 --- a/src/test/correct/function/clang_no_plt_no_pic/function.expected +++ b/src/test/correct/function/clang_no_plt_no_pic/function.expected @@ -1,61 +1,61 @@ -var Gamma_R0: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $y_addr: bv64; -axiom ($y_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,7 +96,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -105,12 +105,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1884bv64) == 1bv8); free requires (memory_load8_le(mem, 1885bv64) == 0bv8); @@ -191,7 +191,7 @@ procedure get_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R29, R30, R31, R8, R9, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == true); @@ -288,8 +288,8 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); diff --git a/src/test/correct/function/clang_pic/function.expected b/src/test/correct/function/clang_pic/function.expected index bcd55e2bb..54d1bb9de 100644 --- a/src/test/correct/function/clang_pic/function.expected +++ b/src/test/correct/function/clang_pic/function.expected @@ -1,61 +1,61 @@ -var Gamma_R0: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $y_addr: bv64; -axiom ($y_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -112,7 +112,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -121,12 +121,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1956bv64) == 1bv8); free requires (memory_load8_le(mem, 1957bv64) == 0bv8); @@ -239,7 +239,7 @@ procedure get_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R29, R30, R31, R8, R9, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == true); @@ -368,8 +368,8 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); diff --git a/src/test/correct/function/gcc/function.expected b/src/test/correct/function/gcc/function.expected index a475b42d0..8916c1618 100644 --- a/src/test/correct/function/gcc/function.expected +++ b/src/test/correct/function/gcc/function.expected @@ -1,60 +1,60 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -95,7 +95,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -104,12 +104,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1896bv64) == 1bv8); free requires (memory_load8_le(mem, 1897bv64) == 0bv8); @@ -190,7 +190,7 @@ procedure get_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == true); @@ -287,8 +287,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); diff --git a/src/test/correct/function/gcc_O2/function.expected b/src/test/correct/function/gcc_O2/function.expected index 0131820aa..7e43c3063 100644 --- a/src/test/correct/function/gcc_O2/function.expected +++ b/src/test/correct/function/gcc_O2/function.expected @@ -1,39 +1,39 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_R3: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var R3: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R3: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R3: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -74,7 +74,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,12 +83,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R3, Gamma_mem, R0, R1, R2, R3, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == true); diff --git a/src/test/correct/function/gcc_no_plt_no_pic/function.expected b/src/test/correct/function/gcc_no_plt_no_pic/function.expected index a475b42d0..8916c1618 100644 --- a/src/test/correct/function/gcc_no_plt_no_pic/function.expected +++ b/src/test/correct/function/gcc_no_plt_no_pic/function.expected @@ -1,60 +1,60 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -95,7 +95,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -104,12 +104,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1896bv64) == 1bv8); free requires (memory_load8_le(mem, 1897bv64) == 0bv8); @@ -190,7 +190,7 @@ procedure get_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == true); @@ -287,8 +287,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); diff --git a/src/test/correct/function/gcc_pic/function.expected b/src/test/correct/function/gcc_pic/function.expected index 20ca626e6..f7c0f43c3 100644 --- a/src/test/correct/function/gcc_pic/function.expected +++ b/src/test/correct/function/gcc_pic/function.expected @@ -1,60 +1,60 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -111,7 +111,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -120,12 +120,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1960bv64) == 1bv8); free requires (memory_load8_le(mem, 1961bv64) == 0bv8); @@ -238,7 +238,7 @@ procedure get_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == true); @@ -367,8 +367,8 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); diff --git a/src/test/correct/function1/clang/function1.expected b/src/test/correct/function1/clang/function1.expected index 209b36c74..323914599 100644 --- a/src/test/correct/function1/clang/function1.expected +++ b/src/test/correct/function1/clang/function1.expected @@ -1,91 +1,91 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R2: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R2: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2024bv64); -const $x_addr: bv64; -axiom ($x_addr == 69692bv64); -const $y_addr: bv64; -axiom ($y_addr == 69696bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2024bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69692bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69696bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "sign_extend 32"} sign_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 32"} sign_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -130,7 +130,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -139,12 +139,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_stack, R0, R31, R8, R9, stack; free requires (memory_load8_le(mem, 2024bv64) == 1bv8); free requires (memory_load8_le(mem, 2025bv64) == 0bv8); @@ -244,7 +244,7 @@ procedure get_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R2, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -347,8 +347,8 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -388,7 +388,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2024bv64) == 1bv8); free requires (memory_load8_le(mem, 2025bv64) == 0bv8); diff --git a/src/test/correct/function1/clang_O2/function1.expected b/src/test/correct/function1/clang_O2/function1.expected index b5fb16057..21ae07234 100644 --- a/src/test/correct/function1/clang_O2/function1.expected +++ b/src/test/correct/function1/clang_O2/function1.expected @@ -1,70 +1,70 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R10: bool; -var Gamma_R11: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R10: bv64; -var R11: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1976bv64); -const $x_addr: bv64; -axiom ($x_addr == 69692bv64); -const $y_addr: bv64; -axiom ($y_addr == 69696bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R11: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R10: bv64; +var {:extern } R11: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1976bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69692bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69696bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,7 +109,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -118,12 +118,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R10, Gamma_R11, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R10, R11, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -226,8 +226,8 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -260,7 +260,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1976bv64) == 1bv8); free requires (memory_load8_le(mem, 1977bv64) == 0bv8); diff --git a/src/test/correct/function1/clang_no_plt_no_pic/function1.expected b/src/test/correct/function1/clang_no_plt_no_pic/function1.expected index a2b338593..dc22a11ee 100644 --- a/src/test/correct/function1/clang_no_plt_no_pic/function1.expected +++ b/src/test/correct/function1/clang_no_plt_no_pic/function1.expected @@ -1,91 +1,91 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R2: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R2: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2024bv64); -const $x_addr: bv64; -axiom ($x_addr == 69692bv64); -const $y_addr: bv64; -axiom ($y_addr == 69696bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2024bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69692bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69696bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "sign_extend 32"} sign_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 32"} sign_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -130,7 +130,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -139,12 +139,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_stack, R0, R31, R8, R9, stack; free requires (memory_load8_le(mem, 2024bv64) == 1bv8); free requires (memory_load8_le(mem, 2025bv64) == 0bv8); @@ -244,7 +244,7 @@ procedure get_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R2, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -347,8 +347,8 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -388,7 +388,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2024bv64) == 1bv8); free requires (memory_load8_le(mem, 2025bv64) == 0bv8); diff --git a/src/test/correct/function1/clang_pic/function1.expected b/src/test/correct/function1/clang_pic/function1.expected index e0f10770f..7772d879f 100644 --- a/src/test/correct/function1/clang_pic/function1.expected +++ b/src/test/correct/function1/clang_pic/function1.expected @@ -1,91 +1,91 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R2: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R2: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2096bv64); -const $x_addr: bv64; -axiom ($x_addr == 69692bv64); -const $y_addr: bv64; -axiom ($y_addr == 69696bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2096bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69692bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69696bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "sign_extend 32"} sign_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 32"} sign_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -146,7 +146,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69590bv64) == 0bv8); free ensures (memory_load8_le(mem, 69591bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -155,12 +155,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_stack, R0, R31, R8, R9, stack; free requires (memory_load8_le(mem, 2096bv64) == 1bv8); free requires (memory_load8_le(mem, 2097bv64) == 0bv8); @@ -292,7 +292,7 @@ procedure get_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R2, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -427,8 +427,8 @@ procedure main() free ensures (memory_load8_le(mem, 69590bv64) == 0bv8); free ensures (memory_load8_le(mem, 69591bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -472,7 +472,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2096bv64) == 1bv8); free requires (memory_load8_le(mem, 2097bv64) == 0bv8); diff --git a/src/test/correct/function1/gcc/function1.expected b/src/test/correct/function1/gcc/function1.expected index 2e0921299..8957c04b8 100644 --- a/src/test/correct/function1/gcc/function1.expected +++ b/src/test/correct/function1/gcc/function1.expected @@ -1,86 +1,86 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R2: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R2: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2048bv64); -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2048bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -129,7 +129,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -138,12 +138,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_stack, R0, R1, R31, stack; free requires (memory_load8_le(mem, 2048bv64) == 1bv8); free requires (memory_load8_le(mem, 2049bv64) == 0bv8); @@ -251,7 +251,7 @@ procedure get_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R2, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -362,8 +362,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -409,7 +409,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2048bv64) == 1bv8); free requires (memory_load8_le(mem, 2049bv64) == 0bv8); diff --git a/src/test/correct/function1/gcc_O2/function1.expected b/src/test/correct/function1/gcc_O2/function1.expected index b201a791e..f7a142a97 100644 --- a/src/test/correct/function1/gcc_O2/function1.expected +++ b/src/test/correct/function1/gcc_O2/function1.expected @@ -1,66 +1,66 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R2: bool; -var Gamma_R29: bool; -var Gamma_R3: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R2: bv64; -var R29: bv64; -var R3: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2048bv64); -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R3: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R3: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2048bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,7 +109,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -118,12 +118,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure __printf_chk(); +procedure __printf_chk(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2048bv64) == 1bv8); free requires (memory_load8_le(mem, 2049bv64) == 0bv8); @@ -214,7 +214,7 @@ procedure __printf_chk(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R3, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R2, R29, R3, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -325,8 +325,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv64; - var Gamma_#1: bool; + var #1: bv64; + var Gamma_#1: bool; lmain: #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); diff --git a/src/test/correct/function1/gcc_no_plt_no_pic/function1.expected b/src/test/correct/function1/gcc_no_plt_no_pic/function1.expected index 75b3a0aad..3dd41d9b9 100644 --- a/src/test/correct/function1/gcc_no_plt_no_pic/function1.expected +++ b/src/test/correct/function1/gcc_no_plt_no_pic/function1.expected @@ -1,86 +1,86 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R2: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R2: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2048bv64); -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2048bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -129,7 +129,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -138,12 +138,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_stack, R0, R1, R31, stack; free requires (memory_load8_le(mem, 2048bv64) == 1bv8); free requires (memory_load8_le(mem, 2049bv64) == 0bv8); @@ -251,7 +251,7 @@ procedure get_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R2, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -362,8 +362,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -409,7 +409,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2048bv64) == 1bv8); free requires (memory_load8_le(mem, 2049bv64) == 0bv8); diff --git a/src/test/correct/function1/gcc_pic/function1.expected b/src/test/correct/function1/gcc_pic/function1.expected index b33c27c06..fa4260255 100644 --- a/src/test/correct/function1/gcc_pic/function1.expected +++ b/src/test/correct/function1/gcc_pic/function1.expected @@ -1,86 +1,86 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R2: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R2: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2112bv64); -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2112bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -145,7 +145,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -154,12 +154,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_stack, R0, R1, R31, stack; free requires (memory_load8_le(mem, 2112bv64) == 1bv8); free requires (memory_load8_le(mem, 2113bv64) == 0bv8); @@ -299,7 +299,7 @@ procedure get_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R2, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -442,8 +442,8 @@ procedure main() free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -492,7 +492,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2112bv64) == 1bv8); free requires (memory_load8_le(mem, 2113bv64) == 0bv8); diff --git a/src/test/correct/functions_with_params/clang/functions_with_params.expected b/src/test/correct/functions_with_params/clang/functions_with_params.expected index 6fdd643ea..f900ce760 100644 --- a/src/test/correct/functions_with_params/clang/functions_with_params.expected +++ b/src/test/correct/functions_with_params/clang/functions_with_params.expected @@ -1,59 +1,59 @@ -var Gamma_R0: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1912bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1912bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,12 +103,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_stack, R0, R29, R30, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -203,10 +203,10 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; @@ -231,7 +231,7 @@ procedure main() return; } -procedure plus_one() +procedure plus_one() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 1912bv64) == 1bv8); free requires (memory_load8_le(mem, 1913bv64) == 0bv8); diff --git a/src/test/correct/functions_with_params/clang_O2/functions_with_params.expected b/src/test/correct/functions_with_params/clang_O2/functions_with_params.expected index fd922f548..f116be047 100644 --- a/src/test/correct/functions_with_params/clang_O2/functions_with_params.expected +++ b/src/test/correct/functions_with_params/clang_O2/functions_with_params.expected @@ -1,14 +1,14 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var mem: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1848bv64); -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1848bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/correct/functions_with_params/clang_no_plt_no_pic/functions_with_params.expected b/src/test/correct/functions_with_params/clang_no_plt_no_pic/functions_with_params.expected index f17db6c35..6b05b6a02 100644 --- a/src/test/correct/functions_with_params/clang_no_plt_no_pic/functions_with_params.expected +++ b/src/test/correct/functions_with_params/clang_no_plt_no_pic/functions_with_params.expected @@ -1,59 +1,59 @@ -var Gamma_R0: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1912bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1912bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,12 +103,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_stack, R0, R29, R30, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -203,10 +203,10 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; @@ -231,7 +231,7 @@ procedure main() return; } -procedure plus_one() +procedure plus_one() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 1912bv64) == 1bv8); free requires (memory_load8_le(mem, 1913bv64) == 0bv8); diff --git a/src/test/correct/functions_with_params/clang_pic/functions_with_params.expected b/src/test/correct/functions_with_params/clang_pic/functions_with_params.expected index f17db6c35..6b05b6a02 100644 --- a/src/test/correct/functions_with_params/clang_pic/functions_with_params.expected +++ b/src/test/correct/functions_with_params/clang_pic/functions_with_params.expected @@ -1,59 +1,59 @@ -var Gamma_R0: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1912bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1912bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,12 +103,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_stack, R0, R29, R30, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -203,10 +203,10 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; @@ -231,7 +231,7 @@ procedure main() return; } -procedure plus_one() +procedure plus_one() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 1912bv64) == 1bv8); free requires (memory_load8_le(mem, 1913bv64) == 0bv8); diff --git a/src/test/correct/functions_with_params/gcc/functions_with_params.expected b/src/test/correct/functions_with_params/gcc/functions_with_params.expected index be5bbf199..a5d5580f6 100644 --- a/src/test/correct/functions_with_params/gcc/functions_with_params.expected +++ b/src/test/correct/functions_with_params/gcc/functions_with_params.expected @@ -1,57 +1,57 @@ -var Gamma_R0: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1904bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1904bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,12 +101,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -201,8 +201,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -226,7 +226,7 @@ procedure main() return; } -procedure plus_one() +procedure plus_one() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 1904bv64) == 1bv8); free requires (memory_load8_le(mem, 1905bv64) == 0bv8); diff --git a/src/test/correct/functions_with_params/gcc_O2/functions_with_params.expected b/src/test/correct/functions_with_params/gcc_O2/functions_with_params.expected index 81f3e344b..811d75341 100644 --- a/src/test/correct/functions_with_params/gcc_O2/functions_with_params.expected +++ b/src/test/correct/functions_with_params/gcc_O2/functions_with_params.expected @@ -1,14 +1,14 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var mem: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1916bv64); -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1916bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/functions_with_params/gcc_no_plt_no_pic/functions_with_params.expected b/src/test/correct/functions_with_params/gcc_no_plt_no_pic/functions_with_params.expected index 72cfd1a2e..5feac7ab2 100644 --- a/src/test/correct/functions_with_params/gcc_no_plt_no_pic/functions_with_params.expected +++ b/src/test/correct/functions_with_params/gcc_no_plt_no_pic/functions_with_params.expected @@ -1,57 +1,57 @@ -var Gamma_R0: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1904bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1904bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,12 +101,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -201,8 +201,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -226,7 +226,7 @@ procedure main() return; } -procedure plus_one() +procedure plus_one() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 1904bv64) == 1bv8); free requires (memory_load8_le(mem, 1905bv64) == 0bv8); diff --git a/src/test/correct/functions_with_params/gcc_pic/functions_with_params.expected b/src/test/correct/functions_with_params/gcc_pic/functions_with_params.expected index 72cfd1a2e..5feac7ab2 100644 --- a/src/test/correct/functions_with_params/gcc_pic/functions_with_params.expected +++ b/src/test/correct/functions_with_params/gcc_pic/functions_with_params.expected @@ -1,57 +1,57 @@ -var Gamma_R0: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1904bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1904bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,12 +101,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -201,8 +201,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -226,7 +226,7 @@ procedure main() return; } -procedure plus_one() +procedure plus_one() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 1904bv64) == 1bv8); free requires (memory_load8_le(mem, 1905bv64) == 0bv8); diff --git a/src/test/correct/ifbranches/clang/ifbranches.expected b/src/test/correct/ifbranches/clang/ifbranches.expected index 9e3d4da3f..2fceaf281 100644 --- a/src/test/correct/ifbranches/clang/ifbranches.expected +++ b/src/test/correct/ifbranches/clang/ifbranches.expected @@ -1,54 +1,54 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,12 +98,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -197,16 +197,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); diff --git a/src/test/correct/ifbranches/clang_O2/ifbranches.expected b/src/test/correct/ifbranches/clang_O2/ifbranches.expected index 4a3d010fb..ff322ae57 100644 --- a/src/test/correct/ifbranches/clang_O2/ifbranches.expected +++ b/src/test/correct/ifbranches/clang_O2/ifbranches.expected @@ -1,23 +1,23 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var mem: [bv64]bv8; -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,7 +58,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -67,12 +67,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, R0, R8; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -164,16 +164,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R8, Gamma_R8 := 2bv64, true; #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; diff --git a/src/test/correct/ifbranches/clang_no_plt_no_pic/ifbranches.expected b/src/test/correct/ifbranches/clang_no_plt_no_pic/ifbranches.expected index 76136db7d..eec93a45e 100644 --- a/src/test/correct/ifbranches/clang_no_plt_no_pic/ifbranches.expected +++ b/src/test/correct/ifbranches/clang_no_plt_no_pic/ifbranches.expected @@ -1,54 +1,54 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,12 +98,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -197,16 +197,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); diff --git a/src/test/correct/ifbranches/clang_pic/ifbranches.expected b/src/test/correct/ifbranches/clang_pic/ifbranches.expected index 76136db7d..eec93a45e 100644 --- a/src/test/correct/ifbranches/clang_pic/ifbranches.expected +++ b/src/test/correct/ifbranches/clang_pic/ifbranches.expected @@ -1,54 +1,54 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,12 +98,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -197,16 +197,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); diff --git a/src/test/correct/ifbranches/gcc/ifbranches.expected b/src/test/correct/ifbranches/gcc/ifbranches.expected index 956bbeeb6..fa6737faa 100644 --- a/src/test/correct/ifbranches/gcc/ifbranches.expected +++ b/src/test/correct/ifbranches/gcc/ifbranches.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,12 +96,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -195,16 +195,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/correct/ifbranches/gcc_O2/ifbranches.expected b/src/test/correct/ifbranches/gcc_O2/ifbranches.expected index f90c20326..4e0e04f8d 100644 --- a/src/test/correct/ifbranches/gcc_O2/ifbranches.expected +++ b/src/test/correct/ifbranches/gcc_O2/ifbranches.expected @@ -1,21 +1,21 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var mem: [bv64]bv8; -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,7 +56,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -65,12 +65,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -162,16 +162,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv32; - var CF: bv1; - var Gamma_#1: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #1: bv32; + var CF: bv1; + var Gamma_#1: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: #1, Gamma_#1 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#1, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#1); diff --git a/src/test/correct/ifbranches/gcc_no_plt_no_pic/ifbranches.expected b/src/test/correct/ifbranches/gcc_no_plt_no_pic/ifbranches.expected index 6dde1f98e..28a72d1fe 100644 --- a/src/test/correct/ifbranches/gcc_no_plt_no_pic/ifbranches.expected +++ b/src/test/correct/ifbranches/gcc_no_plt_no_pic/ifbranches.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,12 +96,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -195,16 +195,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/correct/ifbranches/gcc_pic/ifbranches.expected b/src/test/correct/ifbranches/gcc_pic/ifbranches.expected index 6dde1f98e..28a72d1fe 100644 --- a/src/test/correct/ifbranches/gcc_pic/ifbranches.expected +++ b/src/test/correct/ifbranches/gcc_pic/ifbranches.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,12 +96,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -195,16 +195,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/correct/ifglobal/clang/ifglobal.expected b/src/test/correct/ifglobal/clang/ifglobal.expected index c96637259..c1562471a 100644 --- a/src/test/correct/ifglobal/clang/ifglobal.expected +++ b/src/test/correct/ifglobal/clang/ifglobal.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,12 +96,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -194,16 +194,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/ifglobal/clang_O2/ifglobal.expected b/src/test/correct/ifglobal/clang_O2/ifglobal.expected index 70f0c3d41..ea6cfcaf2 100644 --- a/src/test/correct/ifglobal/clang_O2/ifglobal.expected +++ b/src/test/correct/ifglobal/clang_O2/ifglobal.expected @@ -1,41 +1,41 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,12 +85,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/correct/ifglobal/clang_no_plt_no_pic/ifglobal.expected b/src/test/correct/ifglobal/clang_no_plt_no_pic/ifglobal.expected index ecd732cd7..3bc70940e 100644 --- a/src/test/correct/ifglobal/clang_no_plt_no_pic/ifglobal.expected +++ b/src/test/correct/ifglobal/clang_no_plt_no_pic/ifglobal.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,12 +96,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -194,16 +194,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/ifglobal/clang_pic/ifglobal.expected b/src/test/correct/ifglobal/clang_pic/ifglobal.expected index 327f31f41..b4a9fc10e 100644 --- a/src/test/correct/ifglobal/clang_pic/ifglobal.expected +++ b/src/test/correct/ifglobal/clang_pic/ifglobal.expected @@ -1,60 +1,60 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,7 +103,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -112,12 +112,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -226,16 +226,16 @@ procedure main() free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/ifglobal/gcc/ifglobal.expected b/src/test/correct/ifglobal/gcc/ifglobal.expected index fa3fd522b..526a339ac 100644 --- a/src/test/correct/ifglobal/gcc/ifglobal.expected +++ b/src/test/correct/ifglobal/gcc/ifglobal.expected @@ -1,46 +1,46 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,16 +186,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/ifglobal/gcc_O2/ifglobal.expected b/src/test/correct/ifglobal/gcc_O2/ifglobal.expected index 2b5fc6a39..342dd9746 100644 --- a/src/test/correct/ifglobal/gcc_O2/ifglobal.expected +++ b/src/test/correct/ifglobal/gcc_O2/ifglobal.expected @@ -1,40 +1,40 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,12 +84,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/ifglobal/gcc_no_plt_no_pic/ifglobal.expected b/src/test/correct/ifglobal/gcc_no_plt_no_pic/ifglobal.expected index b74831af7..64a738f75 100644 --- a/src/test/correct/ifglobal/gcc_no_plt_no_pic/ifglobal.expected +++ b/src/test/correct/ifglobal/gcc_no_plt_no_pic/ifglobal.expected @@ -1,46 +1,46 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,16 +186,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/ifglobal/gcc_pic/ifglobal.expected b/src/test/correct/ifglobal/gcc_pic/ifglobal.expected index 8e6c99707..537c1eafa 100644 --- a/src/test/correct/ifglobal/gcc_pic/ifglobal.expected +++ b/src/test/correct/ifglobal/gcc_pic/ifglobal.expected @@ -1,54 +1,54 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,12 +106,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -218,16 +218,16 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R0, Gamma_R0 := 65536bv64, true; call rely(); diff --git a/src/test/correct/indirect_call/clang_O2/indirect_call.expected b/src/test/correct/indirect_call/clang_O2/indirect_call.expected index 526771429..b1f2385f4 100644 --- a/src/test/correct/indirect_call/clang_O2/indirect_call.expected +++ b/src/test/correct/indirect_call/clang_O2/indirect_call.expected @@ -1,43 +1,43 @@ -var Gamma_R0: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1952bv64); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1952bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -120,7 +120,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -129,12 +129,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -313,8 +313,8 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -340,7 +340,7 @@ procedure main() return; } -procedure puts(); +procedure puts(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1952bv64) == 1bv8); free requires (memory_load8_le(mem, 1953bv64) == 0bv8); diff --git a/src/test/correct/indirect_call/gcc_O2/indirect_call.expected b/src/test/correct/indirect_call/gcc_O2/indirect_call.expected index 46742d3c1..9064b0f6f 100644 --- a/src/test/correct/indirect_call/gcc_O2/indirect_call.expected +++ b/src/test/correct/indirect_call/gcc_O2/indirect_call.expected @@ -1,43 +1,43 @@ -var Gamma_R0: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1984bv64); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1984bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -126,7 +126,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -135,12 +135,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure greet() +procedure greet() modifies Gamma_R0, Gamma_R16, Gamma_R17, R0, R16, R17; free requires (memory_load8_le(mem, 1984bv64) == 1bv8); free requires (memory_load8_le(mem, 1985bv64) == 0bv8); @@ -319,7 +319,7 @@ procedure greet() assume false; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -510,8 +510,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv64; - var Gamma_#1: bool; + var #1: bv64; + var Gamma_#1: bool; lmain: #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); @@ -535,7 +535,7 @@ procedure main() return; } -procedure puts(); +procedure puts(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1984bv64) == 1bv8); free requires (memory_load8_le(mem, 1985bv64) == 0bv8); diff --git a/src/test/correct/initialisation/clang/initialisation.expected b/src/test/correct/initialisation/clang/initialisation.expected index a129d4d89..1e3eef5ac 100644 --- a/src/test/correct/initialisation/clang/initialisation.expected +++ b/src/test/correct/initialisation/clang/initialisation.expected @@ -1,86 +1,86 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R11: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R11: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $a_addr: bv64; -axiom ($a_addr == 69696bv64); -const $x_addr: bv64; -axiom ($x_addr == 69680bv64); -const $y_addr: bv64; -axiom ($y_addr == 69684bv64); -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R11: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R11: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $a_addr: bv64; +axiom {:extern } ($a_addr == 69696bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69680bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvadd"} bvadd65(bv65, bv65) returns (bv65); -function {:bvbuiltin "bvcomp"} bvcomp64(bv64, bv64) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp65(bv65, bv65) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd65(bv65, bv65) returns (bv65); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp64(bv64, bv64) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp65(bv65, bv65) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_64(bv64) returns (bv65); -function {:bvbuiltin "zero_extend 1"} zero_extend1_64(bv64) returns (bv65); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_64(bv64) returns (bv65); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_64(bv64) returns (bv65); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -121,7 +121,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -130,12 +130,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R11, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R11, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -253,16 +253,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv64; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv64; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; diff --git a/src/test/correct/initialisation/clang_O2/initialisation.expected b/src/test/correct/initialisation/clang_O2/initialisation.expected index adf848ee9..fde5ddb83 100644 --- a/src/test/correct/initialisation/clang_O2/initialisation.expected +++ b/src/test/correct/initialisation/clang_O2/initialisation.expected @@ -1,88 +1,88 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R11: bool; -var Gamma_R12: bool; -var Gamma_R13: bool; -var Gamma_R14: bool; -var Gamma_R15: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R11: bv64; -var R12: bv64; -var R13: bv64; -var R14: bv64; -var R15: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $a_addr: bv64; -axiom ($a_addr == 69696bv64); -const $x_addr: bv64; -axiom ($x_addr == 69680bv64); -const $y_addr: bv64; -axiom ($y_addr == 69684bv64); -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R11: bool; +var {:extern } Gamma_R12: bool; +var {:extern } Gamma_R13: bool; +var {:extern } Gamma_R14: bool; +var {:extern } Gamma_R15: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R11: bv64; +var {:extern } R12: bv64; +var {:extern } R13: bv64; +var {:extern } R14: bv64; +var {:extern } R15: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $a_addr: bv64; +axiom {:extern } ($a_addr == 69696bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69680bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -123,7 +123,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -132,12 +132,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R11, Gamma_R12, Gamma_R13, Gamma_R14, Gamma_R15, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R11, R12, R13, R14, R15, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/correct/initialisation/clang_no_plt_no_pic/initialisation.expected b/src/test/correct/initialisation/clang_no_plt_no_pic/initialisation.expected index a129d4d89..1e3eef5ac 100644 --- a/src/test/correct/initialisation/clang_no_plt_no_pic/initialisation.expected +++ b/src/test/correct/initialisation/clang_no_plt_no_pic/initialisation.expected @@ -1,86 +1,86 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R11: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R11: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $a_addr: bv64; -axiom ($a_addr == 69696bv64); -const $x_addr: bv64; -axiom ($x_addr == 69680bv64); -const $y_addr: bv64; -axiom ($y_addr == 69684bv64); -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R11: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R11: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $a_addr: bv64; +axiom {:extern } ($a_addr == 69696bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69680bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvadd"} bvadd65(bv65, bv65) returns (bv65); -function {:bvbuiltin "bvcomp"} bvcomp64(bv64, bv64) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp65(bv65, bv65) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd65(bv65, bv65) returns (bv65); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp64(bv64, bv64) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp65(bv65, bv65) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_64(bv64) returns (bv65); -function {:bvbuiltin "zero_extend 1"} zero_extend1_64(bv64) returns (bv65); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_64(bv64) returns (bv65); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_64(bv64) returns (bv65); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -121,7 +121,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -130,12 +130,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R11, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R11, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -253,16 +253,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv64; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv64; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; diff --git a/src/test/correct/initialisation/clang_pic/initialisation.expected b/src/test/correct/initialisation/clang_pic/initialisation.expected index 02ec4561d..1b5b28dfd 100644 --- a/src/test/correct/initialisation/clang_pic/initialisation.expected +++ b/src/test/correct/initialisation/clang_pic/initialisation.expected @@ -1,84 +1,84 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $a_addr: bv64; -axiom ($a_addr == 69696bv64); -const $x_addr: bv64; -axiom ($x_addr == 69680bv64); -const $y_addr: bv64; -axiom ($y_addr == 69684bv64); -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $a_addr: bv64; +axiom {:extern } ($a_addr == 69696bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69680bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvadd"} bvadd65(bv65, bv65) returns (bv65); -function {:bvbuiltin "bvcomp"} bvcomp64(bv64, bv64) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp65(bv65, bv65) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd65(bv65, bv65) returns (bv65); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp64(bv64, bv64) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp65(bv65, bv65) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_64(bv64) returns (bv65); -function {:bvbuiltin "zero_extend 1"} zero_extend1_64(bv64) returns (bv65); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_64(bv64) returns (bv65); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_64(bv64) returns (bv65); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -151,7 +151,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69566bv64) == 0bv8); free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -160,12 +160,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -347,16 +347,16 @@ procedure main() free ensures (memory_load8_le(mem, 69566bv64) == 0bv8); free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); { - var #4: bv64; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv64; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R9, Gamma_R9 := 65536bv64, true; call rely(); diff --git a/src/test/correct/initialisation/gcc/initialisation.expected b/src/test/correct/initialisation/gcc/initialisation.expected index e6ae1203b..617c09c2e 100644 --- a/src/test/correct/initialisation/gcc/initialisation.expected +++ b/src/test/correct/initialisation/gcc/initialisation.expected @@ -1,74 +1,74 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $a_addr: bv64; -axiom ($a_addr == 69664bv64); -const $x_addr: bv64; -axiom ($x_addr == 69648bv64); -const $y_addr: bv64; -axiom ($y_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $a_addr: bv64; +axiom {:extern } ($a_addr == 69664bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69648bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,7 +109,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -118,12 +118,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/initialisation/gcc_O2/initialisation.expected b/src/test/correct/initialisation/gcc_O2/initialisation.expected index 5902dc0d3..8c5215b05 100644 --- a/src/test/correct/initialisation/gcc_O2/initialisation.expected +++ b/src/test/correct/initialisation/gcc_O2/initialisation.expected @@ -1,84 +1,84 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_R3: bool; -var Gamma_R4: bool; -var Gamma_R5: bool; -var Gamma_R6: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var R3: bv64; -var R4: bv64; -var R5: bv64; -var R6: bv64; -var mem: [bv64]bv8; -const $a_addr: bv64; -axiom ($a_addr == 69664bv64); -const $x_addr: bv64; -axiom ($x_addr == 69648bv64); -const $y_addr: bv64; -axiom ($y_addr == 69672bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R3: bool; +var {:extern } Gamma_R4: bool; +var {:extern } Gamma_R5: bool; +var {:extern } Gamma_R6: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R3: bv64; +var {:extern } R4: bv64; +var {:extern } R5: bv64; +var {:extern } R6: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $a_addr: bv64; +axiom {:extern } ($a_addr == 69664bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69648bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69672bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -119,7 +119,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -128,12 +128,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R3, Gamma_R4, Gamma_R5, Gamma_R6, Gamma_mem, R0, R1, R2, R3, R4, R5, R6, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/initialisation/gcc_no_plt_no_pic/initialisation.expected b/src/test/correct/initialisation/gcc_no_plt_no_pic/initialisation.expected index e6ae1203b..617c09c2e 100644 --- a/src/test/correct/initialisation/gcc_no_plt_no_pic/initialisation.expected +++ b/src/test/correct/initialisation/gcc_no_plt_no_pic/initialisation.expected @@ -1,74 +1,74 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $a_addr: bv64; -axiom ($a_addr == 69664bv64); -const $x_addr: bv64; -axiom ($x_addr == 69648bv64); -const $y_addr: bv64; -axiom ($y_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $a_addr: bv64; +axiom {:extern } ($a_addr == 69664bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69648bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,7 +109,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -118,12 +118,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/initialisation/gcc_pic/initialisation.expected b/src/test/correct/initialisation/gcc_pic/initialisation.expected index fdef9652e..af86755b9 100644 --- a/src/test/correct/initialisation/gcc_pic/initialisation.expected +++ b/src/test/correct/initialisation/gcc_pic/initialisation.expected @@ -1,74 +1,74 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $a_addr: bv64; -axiom ($a_addr == 69664bv64); -const $x_addr: bv64; -axiom ($x_addr == 69648bv64); -const $y_addr: bv64; -axiom ($y_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $a_addr: bv64; +axiom {:extern } ($a_addr == 69664bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69648bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -141,7 +141,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -150,12 +150,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/jumptable/clang_O2/jumptable.expected b/src/test/correct/jumptable/clang_O2/jumptable.expected index 508a59310..35a1c95ff 100644 --- a/src/test/correct/jumptable/clang_O2/jumptable.expected +++ b/src/test/correct/jumptable/clang_O2/jumptable.expected @@ -1,43 +1,43 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1916bv64); -const $x_addr: bv64; -axiom ($x_addr == 69680bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1916bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69680bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -78,7 +78,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,12 +87,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/correct/jumptable/gcc_O2/jumptable.expected b/src/test/correct/jumptable/gcc_O2/jumptable.expected index 5db7e4907..d158bab37 100644 --- a/src/test/correct/jumptable/gcc_O2/jumptable.expected +++ b/src/test/correct/jumptable/gcc_O2/jumptable.expected @@ -1,65 +1,65 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1976bv64); -const $x_addr: bv64; -axiom ($x_addr == 69648bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1976bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69648bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,7 +100,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,12 +109,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure add_six() +procedure add_six() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 1976bv64) == 1bv8); free requires (memory_load8_le(mem, 1977bv64) == 0bv8); @@ -200,7 +200,7 @@ procedure add_six() return; } -procedure add_two() +procedure add_two() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 1976bv64) == 1bv8); free requires (memory_load8_le(mem, 1977bv64) == 0bv8); @@ -286,7 +286,7 @@ procedure add_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -385,8 +385,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv64; - var Gamma_#1: bool; + var #1: bv64; + var Gamma_#1: bool; lmain: #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); @@ -412,7 +412,7 @@ procedure main() return; } -procedure sub_seven() +procedure sub_seven() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 1976bv64) == 1bv8); free requires (memory_load8_le(mem, 1977bv64) == 0bv8); diff --git a/src/test/correct/jumptable3/gcc/jumptable3.expected b/src/test/correct/jumptable3/gcc/jumptable3.expected index b8e5b1154..45ebc85b1 100644 --- a/src/test/correct/jumptable3/gcc/jumptable3.expected +++ b/src/test/correct/jumptable3/gcc/jumptable3.expected @@ -1,69 +1,69 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -104,7 +104,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -113,12 +113,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure add_six() +procedure add_six() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 2356bv64) == 1bv8); free requires (memory_load8_le(mem, 2357bv64) == 0bv8); @@ -207,7 +207,7 @@ procedure add_six() return; } -procedure add_two() +procedure add_two() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 2356bv64) == 1bv8); free requires (memory_load8_le(mem, 2357bv64) == 0bv8); @@ -296,7 +296,7 @@ procedure add_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -396,60 +396,60 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #10: bv32; - var #11: bv32; - var #12: bv32; - var #13: bv32; - var #14: bv32; - var #15: bv32; - var #16: bv32; - var #17: bv32; - var #18: bv32; - var #19: bv32; - var #20: bv32; - var #21: bv32; - var #22: bv32; - var #23: bv32; - var #24: bv32; - var #25: bv32; - var #26: bv32; - var #4: bv64; - var #5: bv32; - var #6: bv32; - var #7: bv32; - var #8: bv32; - var #9: bv32; - var CF: bv1; - var Gamma_#10: bool; - var Gamma_#11: bool; - var Gamma_#12: bool; - var Gamma_#13: bool; - var Gamma_#14: bool; - var Gamma_#15: bool; - var Gamma_#16: bool; - var Gamma_#17: bool; - var Gamma_#18: bool; - var Gamma_#19: bool; - var Gamma_#20: bool; - var Gamma_#21: bool; - var Gamma_#22: bool; - var Gamma_#23: bool; - var Gamma_#24: bool; - var Gamma_#25: bool; - var Gamma_#26: bool; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_#7: bool; - var Gamma_#8: bool; - var Gamma_#9: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #10: bv32; + var #11: bv32; + var #12: bv32; + var #13: bv32; + var #14: bv32; + var #15: bv32; + var #16: bv32; + var #17: bv32; + var #18: bv32; + var #19: bv32; + var #20: bv32; + var #21: bv32; + var #22: bv32; + var #23: bv32; + var #24: bv32; + var #25: bv32; + var #26: bv32; + var #4: bv64; + var #5: bv32; + var #6: bv32; + var #7: bv32; + var #8: bv32; + var #9: bv32; + var CF: bv1; + var Gamma_#10: bool; + var Gamma_#11: bool; + var Gamma_#12: bool; + var Gamma_#13: bool; + var Gamma_#14: bool; + var Gamma_#15: bool; + var Gamma_#16: bool; + var Gamma_#17: bool; + var Gamma_#18: bool; + var Gamma_#19: bool; + var Gamma_#20: bool; + var Gamma_#21: bool; + var Gamma_#22: bool; + var Gamma_#23: bool; + var Gamma_#24: bool; + var Gamma_#25: bool; + var Gamma_#26: bool; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_#7: bool; + var Gamma_#8: bool; + var Gamma_#9: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -829,7 +829,7 @@ procedure main() return; } -procedure sub_seven() +procedure sub_seven() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 2356bv64) == 1bv8); free requires (memory_load8_le(mem, 2357bv64) == 0bv8); diff --git a/src/test/correct/jumptable3/gcc_O2/jumptable3.expected b/src/test/correct/jumptable3/gcc_O2/jumptable3.expected index bf0bc5c31..ac0f6ba51 100644 --- a/src/test/correct/jumptable3/gcc_O2/jumptable3.expected +++ b/src/test/correct/jumptable3/gcc_O2/jumptable3.expected @@ -1,45 +1,45 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -80,7 +80,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,12 +89,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -190,34 +190,34 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv32; - var #10: bv32; - var #11: bv32; - var #12: bv32; - var #13: bv32; - var #5: bv32; - var #6: bv32; - var #7: bv32; - var #8: bv32; - var #9: bv32; - var CF: bv1; - var Gamma_#1: bool; - var Gamma_#10: bool; - var Gamma_#11: bool; - var Gamma_#12: bool; - var Gamma_#13: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_#7: bool; - var Gamma_#8: bool; - var Gamma_#9: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #1: bv32; + var #10: bv32; + var #11: bv32; + var #12: bv32; + var #13: bv32; + var #5: bv32; + var #6: bv32; + var #7: bv32; + var #8: bv32; + var #9: bv32; + var CF: bv1; + var Gamma_#1: bool; + var Gamma_#10: bool; + var Gamma_#11: bool; + var Gamma_#12: bool; + var Gamma_#13: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_#7: bool; + var Gamma_#8: bool; + var Gamma_#9: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R1, Gamma_R1 := 69632bv64, true; #1, Gamma_#1 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; diff --git a/src/test/correct/jumptable3/gcc_no_plt_no_pic/jumptable3.expected b/src/test/correct/jumptable3/gcc_no_plt_no_pic/jumptable3.expected index a6cb75ea3..1bd68c2f8 100644 --- a/src/test/correct/jumptable3/gcc_no_plt_no_pic/jumptable3.expected +++ b/src/test/correct/jumptable3/gcc_no_plt_no_pic/jumptable3.expected @@ -1,69 +1,69 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -104,7 +104,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -113,12 +113,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure add_six() +procedure add_six() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 2356bv64) == 1bv8); free requires (memory_load8_le(mem, 2357bv64) == 0bv8); @@ -207,7 +207,7 @@ procedure add_six() return; } -procedure add_two() +procedure add_two() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 2356bv64) == 1bv8); free requires (memory_load8_le(mem, 2357bv64) == 0bv8); @@ -296,7 +296,7 @@ procedure add_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -396,60 +396,60 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #10: bv32; - var #11: bv32; - var #12: bv32; - var #13: bv32; - var #14: bv32; - var #15: bv32; - var #16: bv32; - var #17: bv32; - var #18: bv32; - var #19: bv32; - var #20: bv32; - var #21: bv32; - var #22: bv32; - var #23: bv32; - var #24: bv32; - var #25: bv32; - var #26: bv32; - var #4: bv64; - var #5: bv32; - var #6: bv32; - var #7: bv32; - var #8: bv32; - var #9: bv32; - var CF: bv1; - var Gamma_#10: bool; - var Gamma_#11: bool; - var Gamma_#12: bool; - var Gamma_#13: bool; - var Gamma_#14: bool; - var Gamma_#15: bool; - var Gamma_#16: bool; - var Gamma_#17: bool; - var Gamma_#18: bool; - var Gamma_#19: bool; - var Gamma_#20: bool; - var Gamma_#21: bool; - var Gamma_#22: bool; - var Gamma_#23: bool; - var Gamma_#24: bool; - var Gamma_#25: bool; - var Gamma_#26: bool; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_#7: bool; - var Gamma_#8: bool; - var Gamma_#9: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #10: bv32; + var #11: bv32; + var #12: bv32; + var #13: bv32; + var #14: bv32; + var #15: bv32; + var #16: bv32; + var #17: bv32; + var #18: bv32; + var #19: bv32; + var #20: bv32; + var #21: bv32; + var #22: bv32; + var #23: bv32; + var #24: bv32; + var #25: bv32; + var #26: bv32; + var #4: bv64; + var #5: bv32; + var #6: bv32; + var #7: bv32; + var #8: bv32; + var #9: bv32; + var CF: bv1; + var Gamma_#10: bool; + var Gamma_#11: bool; + var Gamma_#12: bool; + var Gamma_#13: bool; + var Gamma_#14: bool; + var Gamma_#15: bool; + var Gamma_#16: bool; + var Gamma_#17: bool; + var Gamma_#18: bool; + var Gamma_#19: bool; + var Gamma_#20: bool; + var Gamma_#21: bool; + var Gamma_#22: bool; + var Gamma_#23: bool; + var Gamma_#24: bool; + var Gamma_#25: bool; + var Gamma_#26: bool; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_#7: bool; + var Gamma_#8: bool; + var Gamma_#9: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -829,7 +829,7 @@ procedure main() return; } -procedure sub_seven() +procedure sub_seven() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 2356bv64) == 1bv8); free requires (memory_load8_le(mem, 2357bv64) == 0bv8); diff --git a/src/test/correct/jumptable3/gcc_pic/jumptable3.expected b/src/test/correct/jumptable3/gcc_pic/jumptable3.expected index 848f8d9ad..8192e9efc 100644 --- a/src/test/correct/jumptable3/gcc_pic/jumptable3.expected +++ b/src/test/correct/jumptable3/gcc_pic/jumptable3.expected @@ -1,69 +1,69 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -112,7 +112,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -121,12 +121,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure add_six() +procedure add_six() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 2420bv64) == 1bv8); free requires (memory_load8_le(mem, 2421bv64) == 0bv8); @@ -233,7 +233,7 @@ procedure add_six() return; } -procedure add_two() +procedure add_two() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 2420bv64) == 1bv8); free requires (memory_load8_le(mem, 2421bv64) == 0bv8); @@ -340,7 +340,7 @@ procedure add_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -456,60 +456,60 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var #10: bv32; - var #11: bv32; - var #12: bv32; - var #13: bv32; - var #14: bv32; - var #15: bv32; - var #16: bv32; - var #17: bv32; - var #18: bv32; - var #19: bv32; - var #20: bv32; - var #21: bv32; - var #22: bv32; - var #23: bv32; - var #24: bv32; - var #25: bv32; - var #26: bv32; - var #4: bv64; - var #5: bv32; - var #6: bv32; - var #7: bv32; - var #8: bv32; - var #9: bv32; - var CF: bv1; - var Gamma_#10: bool; - var Gamma_#11: bool; - var Gamma_#12: bool; - var Gamma_#13: bool; - var Gamma_#14: bool; - var Gamma_#15: bool; - var Gamma_#16: bool; - var Gamma_#17: bool; - var Gamma_#18: bool; - var Gamma_#19: bool; - var Gamma_#20: bool; - var Gamma_#21: bool; - var Gamma_#22: bool; - var Gamma_#23: bool; - var Gamma_#24: bool; - var Gamma_#25: bool; - var Gamma_#26: bool; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_#7: bool; - var Gamma_#8: bool; - var Gamma_#9: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #10: bv32; + var #11: bv32; + var #12: bv32; + var #13: bv32; + var #14: bv32; + var #15: bv32; + var #16: bv32; + var #17: bv32; + var #18: bv32; + var #19: bv32; + var #20: bv32; + var #21: bv32; + var #22: bv32; + var #23: bv32; + var #24: bv32; + var #25: bv32; + var #26: bv32; + var #4: bv64; + var #5: bv32; + var #6: bv32; + var #7: bv32; + var #8: bv32; + var #9: bv32; + var CF: bv1; + var Gamma_#10: bool; + var Gamma_#11: bool; + var Gamma_#12: bool; + var Gamma_#13: bool; + var Gamma_#14: bool; + var Gamma_#15: bool; + var Gamma_#16: bool; + var Gamma_#17: bool; + var Gamma_#18: bool; + var Gamma_#19: bool; + var Gamma_#20: bool; + var Gamma_#21: bool; + var Gamma_#22: bool; + var Gamma_#23: bool; + var Gamma_#24: bool; + var Gamma_#25: bool; + var Gamma_#26: bool; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_#7: bool; + var Gamma_#8: bool; + var Gamma_#9: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -890,7 +890,7 @@ procedure main() return; } -procedure sub_seven() +procedure sub_seven() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 2420bv64) == 1bv8); free requires (memory_load8_le(mem, 2421bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local/clang/malloc_with_local.expected b/src/test/correct/malloc_with_local/clang/malloc_with_local.expected index 152aff0da..567a3ba00 100644 --- a/src/test/correct/malloc_with_local/clang/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/clang/malloc_with_local.expected @@ -1,83 +1,83 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2256bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2256bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,12 +187,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2256bv64) == 1bv8); free requires (memory_load8_le(mem, 2257bv64) == 0bv8); @@ -387,7 +387,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -602,10 +602,10 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; @@ -682,7 +682,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2256bv64) == 1bv8); free requires (memory_load8_le(mem, 2257bv64) == 0bv8); @@ -877,7 +877,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2256bv64) == 1bv8); free requires (memory_load8_le(mem, 2257bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local/clang_O2/malloc_with_local.expected b/src/test/correct/malloc_with_local/clang_O2/malloc_with_local.expected index 6ecb21b64..2989a2ee6 100644 --- a/src/test/correct/malloc_with_local/clang_O2/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/clang_O2/malloc_with_local.expected @@ -1,45 +1,45 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1964bv64); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1964bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -140,7 +140,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -149,12 +149,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -369,8 +369,8 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -405,7 +405,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1964bv64) == 1bv8); free requires (memory_load8_le(mem, 1965bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local/clang_no_plt_no_pic/malloc_with_local.expected b/src/test/correct/malloc_with_local/clang_no_plt_no_pic/malloc_with_local.expected index cd0687851..c915c2f6f 100644 --- a/src/test/correct/malloc_with_local/clang_no_plt_no_pic/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/clang_no_plt_no_pic/malloc_with_local.expected @@ -1,83 +1,83 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2256bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2256bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,12 +187,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2256bv64) == 1bv8); free requires (memory_load8_le(mem, 2257bv64) == 0bv8); @@ -387,7 +387,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -602,10 +602,10 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; @@ -682,7 +682,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2256bv64) == 1bv8); free requires (memory_load8_le(mem, 2257bv64) == 0bv8); @@ -877,7 +877,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2256bv64) == 1bv8); free requires (memory_load8_le(mem, 2257bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local/clang_pic/malloc_with_local.expected b/src/test/correct/malloc_with_local/clang_pic/malloc_with_local.expected index cd0687851..c915c2f6f 100644 --- a/src/test/correct/malloc_with_local/clang_pic/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/clang_pic/malloc_with_local.expected @@ -1,83 +1,83 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2256bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2256bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,12 +187,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2256bv64) == 1bv8); free requires (memory_load8_le(mem, 2257bv64) == 0bv8); @@ -387,7 +387,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -602,10 +602,10 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; @@ -682,7 +682,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2256bv64) == 1bv8); free requires (memory_load8_le(mem, 2257bv64) == 0bv8); @@ -877,7 +877,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2256bv64) == 1bv8); free requires (memory_load8_le(mem, 2257bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local/gcc/malloc_with_local.expected b/src/test/correct/malloc_with_local/gcc/malloc_with_local.expected index 746e71b97..4e2c75782 100644 --- a/src/test/correct/malloc_with_local/gcc/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/gcc/malloc_with_local.expected @@ -1,79 +1,79 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2248bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2248bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,12 +194,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2248bv64) == 1bv8); free requires (memory_load8_le(mem, 2249bv64) == 0bv8); @@ -416,7 +416,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -653,8 +653,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -729,7 +729,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2248bv64) == 1bv8); free requires (memory_load8_le(mem, 2249bv64) == 0bv8); @@ -946,7 +946,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2248bv64) == 1bv8); free requires (memory_load8_le(mem, 2249bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local/gcc_O2/malloc_with_local.expected b/src/test/correct/malloc_with_local/gcc_O2/malloc_with_local.expected index 0226bf176..8f3b6dc33 100644 --- a/src/test/correct/malloc_with_local/gcc_O2/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/gcc_O2/malloc_with_local.expected @@ -1,47 +1,47 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R2: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R2: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2088bv64); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2088bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -153,7 +153,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -162,12 +162,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure __printf_chk(); +procedure __printf_chk(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2088bv64) == 1bv8); free requires (memory_load8_le(mem, 2089bv64) == 0bv8); @@ -384,7 +384,7 @@ procedure __printf_chk(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R1, R16, R17, R2, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -621,8 +621,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv64; - var Gamma_#1: bool; + var #1: bv64; + var Gamma_#1: bool; lmain: #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); diff --git a/src/test/correct/malloc_with_local/gcc_no_plt_no_pic/malloc_with_local.expected b/src/test/correct/malloc_with_local/gcc_no_plt_no_pic/malloc_with_local.expected index 3a6f53042..818217a0f 100644 --- a/src/test/correct/malloc_with_local/gcc_no_plt_no_pic/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/gcc_no_plt_no_pic/malloc_with_local.expected @@ -1,79 +1,79 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2248bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2248bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,12 +194,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2248bv64) == 1bv8); free requires (memory_load8_le(mem, 2249bv64) == 0bv8); @@ -416,7 +416,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -653,8 +653,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -729,7 +729,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2248bv64) == 1bv8); free requires (memory_load8_le(mem, 2249bv64) == 0bv8); @@ -946,7 +946,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2248bv64) == 1bv8); free requires (memory_load8_le(mem, 2249bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local/gcc_pic/malloc_with_local.expected b/src/test/correct/malloc_with_local/gcc_pic/malloc_with_local.expected index 3a6f53042..818217a0f 100644 --- a/src/test/correct/malloc_with_local/gcc_pic/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/gcc_pic/malloc_with_local.expected @@ -1,79 +1,79 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2248bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2248bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,12 +194,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2248bv64) == 1bv8); free requires (memory_load8_le(mem, 2249bv64) == 0bv8); @@ -416,7 +416,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -653,8 +653,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -729,7 +729,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2248bv64) == 1bv8); free requires (memory_load8_le(mem, 2249bv64) == 0bv8); @@ -946,7 +946,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2248bv64) == 1bv8); free requires (memory_load8_le(mem, 2249bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local2/clang/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/clang/malloc_with_local2.expected index 3f1de863a..dc03e7a27 100644 --- a/src/test/correct/malloc_with_local2/clang/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/clang/malloc_with_local2.expected @@ -1,83 +1,83 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2292bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2292bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,12 +187,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2292bv64) == 1bv8); free requires (memory_load8_le(mem, 2293bv64) == 0bv8); @@ -387,7 +387,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -602,10 +602,10 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; @@ -694,7 +694,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2292bv64) == 1bv8); free requires (memory_load8_le(mem, 2293bv64) == 0bv8); @@ -889,7 +889,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2292bv64) == 1bv8); free requires (memory_load8_le(mem, 2293bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local2/clang_O2/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/clang_O2/malloc_with_local2.expected index 6ecb21b64..2989a2ee6 100644 --- a/src/test/correct/malloc_with_local2/clang_O2/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/clang_O2/malloc_with_local2.expected @@ -1,45 +1,45 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1964bv64); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1964bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -140,7 +140,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -149,12 +149,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -369,8 +369,8 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -405,7 +405,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1964bv64) == 1bv8); free requires (memory_load8_le(mem, 1965bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local2/clang_no_plt_no_pic/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/clang_no_plt_no_pic/malloc_with_local2.expected index 4552108bd..4eced541a 100644 --- a/src/test/correct/malloc_with_local2/clang_no_plt_no_pic/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/clang_no_plt_no_pic/malloc_with_local2.expected @@ -1,83 +1,83 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2292bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2292bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,12 +187,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2292bv64) == 1bv8); free requires (memory_load8_le(mem, 2293bv64) == 0bv8); @@ -387,7 +387,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -602,10 +602,10 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; @@ -694,7 +694,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2292bv64) == 1bv8); free requires (memory_load8_le(mem, 2293bv64) == 0bv8); @@ -889,7 +889,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2292bv64) == 1bv8); free requires (memory_load8_le(mem, 2293bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local2/clang_pic/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/clang_pic/malloc_with_local2.expected index 4552108bd..4eced541a 100644 --- a/src/test/correct/malloc_with_local2/clang_pic/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/clang_pic/malloc_with_local2.expected @@ -1,83 +1,83 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2292bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2292bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,12 +187,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2292bv64) == 1bv8); free requires (memory_load8_le(mem, 2293bv64) == 0bv8); @@ -387,7 +387,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -602,10 +602,10 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; @@ -694,7 +694,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2292bv64) == 1bv8); free requires (memory_load8_le(mem, 2293bv64) == 0bv8); @@ -889,7 +889,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2292bv64) == 1bv8); free requires (memory_load8_le(mem, 2293bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local2/gcc/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/gcc/malloc_with_local2.expected index 2b193e1e8..eb2fbbaac 100644 --- a/src/test/correct/malloc_with_local2/gcc/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/gcc/malloc_with_local2.expected @@ -1,79 +1,79 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2272bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2272bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,12 +194,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2272bv64) == 1bv8); free requires (memory_load8_le(mem, 2273bv64) == 0bv8); @@ -416,7 +416,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -653,8 +653,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -739,7 +739,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2272bv64) == 1bv8); free requires (memory_load8_le(mem, 2273bv64) == 0bv8); @@ -956,7 +956,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2272bv64) == 1bv8); free requires (memory_load8_le(mem, 2273bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local2/gcc_O2/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/gcc_O2/malloc_with_local2.expected index 0226bf176..8f3b6dc33 100644 --- a/src/test/correct/malloc_with_local2/gcc_O2/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/gcc_O2/malloc_with_local2.expected @@ -1,47 +1,47 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R2: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R2: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2088bv64); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2088bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -153,7 +153,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -162,12 +162,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure __printf_chk(); +procedure __printf_chk(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2088bv64) == 1bv8); free requires (memory_load8_le(mem, 2089bv64) == 0bv8); @@ -384,7 +384,7 @@ procedure __printf_chk(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R1, R16, R17, R2, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -621,8 +621,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv64; - var Gamma_#1: bool; + var #1: bv64; + var Gamma_#1: bool; lmain: #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); diff --git a/src/test/correct/malloc_with_local2/gcc_no_plt_no_pic/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/gcc_no_plt_no_pic/malloc_with_local2.expected index def33f328..652536323 100644 --- a/src/test/correct/malloc_with_local2/gcc_no_plt_no_pic/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/gcc_no_plt_no_pic/malloc_with_local2.expected @@ -1,79 +1,79 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2272bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2272bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,12 +194,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2272bv64) == 1bv8); free requires (memory_load8_le(mem, 2273bv64) == 0bv8); @@ -416,7 +416,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -653,8 +653,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -739,7 +739,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2272bv64) == 1bv8); free requires (memory_load8_le(mem, 2273bv64) == 0bv8); @@ -956,7 +956,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2272bv64) == 1bv8); free requires (memory_load8_le(mem, 2273bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local2/gcc_pic/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/gcc_pic/malloc_with_local2.expected index def33f328..652536323 100644 --- a/src/test/correct/malloc_with_local2/gcc_pic/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/gcc_pic/malloc_with_local2.expected @@ -1,79 +1,79 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2272bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2272bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,12 +194,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2272bv64) == 1bv8); free requires (memory_load8_le(mem, 2273bv64) == 0bv8); @@ -416,7 +416,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -653,8 +653,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -739,7 +739,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2272bv64) == 1bv8); free requires (memory_load8_le(mem, 2273bv64) == 0bv8); @@ -956,7 +956,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2272bv64) == 1bv8); free requires (memory_load8_le(mem, 2273bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local3/clang/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/clang/malloc_with_local3.expected index 60ac9d4d2..58f3308ab 100644 --- a/src/test/correct/malloc_with_local3/clang/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/clang/malloc_with_local3.expected @@ -1,84 +1,84 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2344bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2344bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,12 +194,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); @@ -406,7 +406,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -633,10 +633,10 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #7: bv64; - var Gamma_#4: bool; - var Gamma_#7: bool; + var #4: bv64; + var #7: bv64; + var Gamma_#4: bool; + var Gamma_#7: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; @@ -721,7 +721,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); @@ -928,7 +928,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printCharValue() +procedure printCharValue() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); @@ -1139,10 +1139,10 @@ procedure printCharValue() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #5: bv64; - var #6: bv64; - var Gamma_#5: bool; - var Gamma_#6: bool; + var #5: bv64; + var #6: bv64; + var Gamma_#5: bool; + var Gamma_#6: bool; lprintCharValue: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; @@ -1173,7 +1173,7 @@ procedure printCharValue() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local3/clang_O2/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/clang_O2/malloc_with_local3.expected index fcdb3676c..a4afe325d 100644 --- a/src/test/correct/malloc_with_local3/clang_O2/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/clang_O2/malloc_with_local3.expected @@ -1,45 +1,45 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1996bv64); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1996bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -146,7 +146,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -155,12 +155,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -387,8 +387,8 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -423,7 +423,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1996bv64) == 1bv8); free requires (memory_load8_le(mem, 1997bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local3/clang_no_plt_no_pic/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/clang_no_plt_no_pic/malloc_with_local3.expected index c837ae5b3..1f9ca1021 100644 --- a/src/test/correct/malloc_with_local3/clang_no_plt_no_pic/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/clang_no_plt_no_pic/malloc_with_local3.expected @@ -1,84 +1,84 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2344bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2344bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,12 +194,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); @@ -406,7 +406,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -633,10 +633,10 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #7: bv64; - var Gamma_#4: bool; - var Gamma_#7: bool; + var #4: bv64; + var #7: bv64; + var Gamma_#4: bool; + var Gamma_#7: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; @@ -721,7 +721,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); @@ -928,7 +928,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printCharValue() +procedure printCharValue() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); @@ -1139,10 +1139,10 @@ procedure printCharValue() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #5: bv64; - var #6: bv64; - var Gamma_#5: bool; - var Gamma_#6: bool; + var #5: bv64; + var #6: bv64; + var Gamma_#5: bool; + var Gamma_#6: bool; lprintCharValue: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; @@ -1173,7 +1173,7 @@ procedure printCharValue() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local3/clang_pic/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/clang_pic/malloc_with_local3.expected index c837ae5b3..1f9ca1021 100644 --- a/src/test/correct/malloc_with_local3/clang_pic/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/clang_pic/malloc_with_local3.expected @@ -1,84 +1,84 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2344bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2344bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,12 +194,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); @@ -406,7 +406,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -633,10 +633,10 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #7: bv64; - var Gamma_#4: bool; - var Gamma_#7: bool; + var #4: bv64; + var #7: bv64; + var Gamma_#4: bool; + var Gamma_#7: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; @@ -721,7 +721,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); @@ -928,7 +928,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printCharValue() +procedure printCharValue() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); @@ -1139,10 +1139,10 @@ procedure printCharValue() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #5: bv64; - var #6: bv64; - var Gamma_#5: bool; - var Gamma_#6: bool; + var #5: bv64; + var #6: bv64; + var Gamma_#5: bool; + var Gamma_#6: bool; lprintCharValue: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; @@ -1173,7 +1173,7 @@ procedure printCharValue() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local3/gcc/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/gcc/malloc_with_local3.expected index c96cea995..9eabf2e81 100644 --- a/src/test/correct/malloc_with_local3/gcc/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/gcc/malloc_with_local3.expected @@ -1,80 +1,80 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2328bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2328bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -190,7 +190,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -199,12 +199,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); @@ -429,7 +429,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -674,8 +674,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -755,7 +755,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); @@ -980,7 +980,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printCharValue() +procedure printCharValue() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); @@ -1209,8 +1209,8 @@ procedure printCharValue() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #5: bv64; - var Gamma_#5: bool; + var #5: bv64; + var Gamma_#5: bool; lprintCharValue: #5, Gamma_#5 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); @@ -1243,7 +1243,7 @@ procedure printCharValue() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local3/gcc_O2/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/gcc_O2/malloc_with_local3.expected index 590d1c18b..66020e141 100644 --- a/src/test/correct/malloc_with_local3/gcc_O2/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/gcc_O2/malloc_with_local3.expected @@ -1,70 +1,70 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R19: bool; -var Gamma_R2: bool; -var Gamma_R29: bool; -var Gamma_R3: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R19: bv64; -var R2: bv64; -var R29: bv64; -var R3: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2264bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R19: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R3: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R19: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R3: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2264bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -176,7 +176,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,12 +185,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure __printf_chk(); +procedure __printf_chk(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2264bv64) == 1bv8); free requires (memory_load8_le(mem, 2265bv64) == 0bv8); @@ -407,7 +407,7 @@ procedure __printf_chk(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2264bv64) == 1bv8); free requires (memory_load8_le(mem, 2265bv64) == 0bv8); @@ -624,7 +624,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R19, Gamma_R2, Gamma_R29, Gamma_R3, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R19, R2, R29, R3, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -863,8 +863,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv64; - var Gamma_#1: bool; + var #1: bv64; + var Gamma_#1: bool; lmain: #1, Gamma_#1 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); @@ -915,7 +915,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2264bv64) == 1bv8); free requires (memory_load8_le(mem, 2265bv64) == 0bv8); @@ -1132,7 +1132,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printCharValue() +procedure printCharValue() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R3, Gamma_mem, R0, R1, R16, R17, R2, R3, mem; free requires (memory_load8_le(mem, 2264bv64) == 1bv8); free requires (memory_load8_le(mem, 2265bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local3/gcc_no_plt_no_pic/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/gcc_no_plt_no_pic/malloc_with_local3.expected index 743895881..5c8344994 100644 --- a/src/test/correct/malloc_with_local3/gcc_no_plt_no_pic/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/gcc_no_plt_no_pic/malloc_with_local3.expected @@ -1,80 +1,80 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2328bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2328bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -190,7 +190,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -199,12 +199,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); @@ -429,7 +429,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -674,8 +674,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -755,7 +755,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); @@ -980,7 +980,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printCharValue() +procedure printCharValue() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); @@ -1209,8 +1209,8 @@ procedure printCharValue() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #5: bv64; - var Gamma_#5: bool; + var #5: bv64; + var Gamma_#5: bool; lprintCharValue: #5, Gamma_#5 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); @@ -1243,7 +1243,7 @@ procedure printCharValue() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local3/gcc_pic/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/gcc_pic/malloc_with_local3.expected index 743895881..5c8344994 100644 --- a/src/test/correct/malloc_with_local3/gcc_pic/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/gcc_pic/malloc_with_local3.expected @@ -1,80 +1,80 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2328bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2328bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -190,7 +190,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -199,12 +199,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); @@ -429,7 +429,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -674,8 +674,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -755,7 +755,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); @@ -980,7 +980,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printCharValue() +procedure printCharValue() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); @@ -1209,8 +1209,8 @@ procedure printCharValue() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #5: bv64; - var Gamma_#5: bool; + var #5: bv64; + var Gamma_#5: bool; lprintCharValue: #5, Gamma_#5 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); @@ -1243,7 +1243,7 @@ procedure printCharValue() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); diff --git a/src/test/correct/multi_malloc/clang/multi_malloc.expected b/src/test/correct/multi_malloc/clang/multi_malloc.expected index 5967285b6..cb2f03f7d 100644 --- a/src/test/correct/multi_malloc/clang/multi_malloc.expected +++ b/src/test/correct/multi_malloc/clang/multi_malloc.expected @@ -1,83 +1,83 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2232bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2232bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -151,7 +151,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -160,12 +160,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2232bv64) == 1bv8); free requires (memory_load8_le(mem, 2233bv64) == 0bv8); @@ -306,7 +306,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -467,10 +467,10 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; @@ -538,7 +538,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2232bv64) == 1bv8); free requires (memory_load8_le(mem, 2233bv64) == 0bv8); @@ -679,7 +679,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2232bv64) == 1bv8); free requires (memory_load8_le(mem, 2233bv64) == 0bv8); diff --git a/src/test/correct/multi_malloc/clang_O2/multi_malloc.expected b/src/test/correct/multi_malloc/clang_O2/multi_malloc.expected index 0b5e39a9b..569ac0ece 100644 --- a/src/test/correct/multi_malloc/clang_O2/multi_malloc.expected +++ b/src/test/correct/multi_malloc/clang_O2/multi_malloc.expected @@ -1,45 +1,45 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1948bv64); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1948bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -113,7 +113,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -122,12 +122,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -288,8 +288,8 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -317,7 +317,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1948bv64) == 1bv8); free requires (memory_load8_le(mem, 1949bv64) == 0bv8); diff --git a/src/test/correct/multi_malloc/clang_no_plt_no_pic/multi_malloc.expected b/src/test/correct/multi_malloc/clang_no_plt_no_pic/multi_malloc.expected index 7b6181dcc..d210207e2 100644 --- a/src/test/correct/multi_malloc/clang_no_plt_no_pic/multi_malloc.expected +++ b/src/test/correct/multi_malloc/clang_no_plt_no_pic/multi_malloc.expected @@ -1,83 +1,83 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2232bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2232bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -151,7 +151,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -160,12 +160,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2232bv64) == 1bv8); free requires (memory_load8_le(mem, 2233bv64) == 0bv8); @@ -306,7 +306,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -467,10 +467,10 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; @@ -538,7 +538,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2232bv64) == 1bv8); free requires (memory_load8_le(mem, 2233bv64) == 0bv8); @@ -679,7 +679,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2232bv64) == 1bv8); free requires (memory_load8_le(mem, 2233bv64) == 0bv8); diff --git a/src/test/correct/multi_malloc/clang_pic/multi_malloc.expected b/src/test/correct/multi_malloc/clang_pic/multi_malloc.expected index 7b6181dcc..d210207e2 100644 --- a/src/test/correct/multi_malloc/clang_pic/multi_malloc.expected +++ b/src/test/correct/multi_malloc/clang_pic/multi_malloc.expected @@ -1,83 +1,83 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2232bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2232bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -151,7 +151,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -160,12 +160,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2232bv64) == 1bv8); free requires (memory_load8_le(mem, 2233bv64) == 0bv8); @@ -306,7 +306,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -467,10 +467,10 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; @@ -538,7 +538,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2232bv64) == 1bv8); free requires (memory_load8_le(mem, 2233bv64) == 0bv8); @@ -679,7 +679,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2232bv64) == 1bv8); free requires (memory_load8_le(mem, 2233bv64) == 0bv8); diff --git a/src/test/correct/multi_malloc/gcc/multi_malloc.expected b/src/test/correct/multi_malloc/gcc/multi_malloc.expected index e50dfecd9..5d260845c 100644 --- a/src/test/correct/multi_malloc/gcc/multi_malloc.expected +++ b/src/test/correct/multi_malloc/gcc/multi_malloc.expected @@ -1,79 +1,79 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2224bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2224bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -158,7 +158,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -167,12 +167,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2224bv64) == 1bv8); free requires (memory_load8_le(mem, 2225bv64) == 0bv8); @@ -335,7 +335,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -518,8 +518,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -585,7 +585,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2224bv64) == 1bv8); free requires (memory_load8_le(mem, 2225bv64) == 0bv8); @@ -748,7 +748,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2224bv64) == 1bv8); free requires (memory_load8_le(mem, 2225bv64) == 0bv8); diff --git a/src/test/correct/multi_malloc/gcc_O2/multi_malloc.expected b/src/test/correct/multi_malloc/gcc_O2/multi_malloc.expected index ddca94216..bdf5f4cde 100644 --- a/src/test/correct/multi_malloc/gcc_O2/multi_malloc.expected +++ b/src/test/correct/multi_malloc/gcc_O2/multi_malloc.expected @@ -1,47 +1,47 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R2: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R2: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2024bv64); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2024bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -126,7 +126,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -135,12 +135,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure __printf_chk(); +procedure __printf_chk(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2024bv64) == 1bv8); free requires (memory_load8_le(mem, 2025bv64) == 0bv8); @@ -303,7 +303,7 @@ procedure __printf_chk(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R1, R16, R17, R2, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -486,8 +486,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv64; - var Gamma_#1: bool; + var #1: bv64; + var Gamma_#1: bool; lmain: #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); diff --git a/src/test/correct/multi_malloc/gcc_no_plt_no_pic/multi_malloc.expected b/src/test/correct/multi_malloc/gcc_no_plt_no_pic/multi_malloc.expected index fbdc65c40..091f35ef7 100644 --- a/src/test/correct/multi_malloc/gcc_no_plt_no_pic/multi_malloc.expected +++ b/src/test/correct/multi_malloc/gcc_no_plt_no_pic/multi_malloc.expected @@ -1,79 +1,79 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2224bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2224bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -158,7 +158,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -167,12 +167,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2224bv64) == 1bv8); free requires (memory_load8_le(mem, 2225bv64) == 0bv8); @@ -335,7 +335,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -518,8 +518,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -585,7 +585,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2224bv64) == 1bv8); free requires (memory_load8_le(mem, 2225bv64) == 0bv8); @@ -748,7 +748,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2224bv64) == 1bv8); free requires (memory_load8_le(mem, 2225bv64) == 0bv8); diff --git a/src/test/correct/multi_malloc/gcc_pic/multi_malloc.expected b/src/test/correct/multi_malloc/gcc_pic/multi_malloc.expected index fbdc65c40..091f35ef7 100644 --- a/src/test/correct/multi_malloc/gcc_pic/multi_malloc.expected +++ b/src/test/correct/multi_malloc/gcc_pic/multi_malloc.expected @@ -1,79 +1,79 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 2224bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 2224bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -158,7 +158,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -167,12 +167,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2224bv64) == 1bv8); free requires (memory_load8_le(mem, 2225bv64) == 0bv8); @@ -335,7 +335,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -518,8 +518,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -585,7 +585,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2224bv64) == 1bv8); free requires (memory_load8_le(mem, 2225bv64) == 0bv8); @@ -748,7 +748,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2224bv64) == 1bv8); free requires (memory_load8_le(mem, 2225bv64) == 0bv8); diff --git a/src/test/correct/nestedif/clang/nestedif.expected b/src/test/correct/nestedif/clang/nestedif.expected index a37da1c4d..f67fbb5c7 100644 --- a/src/test/correct/nestedif/clang/nestedif.expected +++ b/src/test/correct/nestedif/clang/nestedif.expected @@ -1,46 +1,46 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1968bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1968bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -188,20 +188,20 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/nestedif/clang_O2/nestedif.expected b/src/test/correct/nestedif/clang_O2/nestedif.expected index 1e9764f80..5f6aef7e1 100644 --- a/src/test/correct/nestedif/clang_O2/nestedif.expected +++ b/src/test/correct/nestedif/clang_O2/nestedif.expected @@ -1,14 +1,14 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var mem: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1840bv64); -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1840bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/correct/nestedif/clang_no_plt_no_pic/nestedif.expected b/src/test/correct/nestedif/clang_no_plt_no_pic/nestedif.expected index c3575bfb5..414246d3e 100644 --- a/src/test/correct/nestedif/clang_no_plt_no_pic/nestedif.expected +++ b/src/test/correct/nestedif/clang_no_plt_no_pic/nestedif.expected @@ -1,46 +1,46 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1968bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1968bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -188,20 +188,20 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/nestedif/clang_pic/nestedif.expected b/src/test/correct/nestedif/clang_pic/nestedif.expected index c3575bfb5..414246d3e 100644 --- a/src/test/correct/nestedif/clang_pic/nestedif.expected +++ b/src/test/correct/nestedif/clang_pic/nestedif.expected @@ -1,46 +1,46 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1968bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1968bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -188,20 +188,20 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/nestedif/gcc/nestedif.expected b/src/test/correct/nestedif/gcc/nestedif.expected index be46c82f4..cd8b37fae 100644 --- a/src/test/correct/nestedif/gcc/nestedif.expected +++ b/src/test/correct/nestedif/gcc/nestedif.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1928bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1928bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,20 +186,20 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 2bv64, true; diff --git a/src/test/correct/nestedif/gcc_O2/nestedif.expected b/src/test/correct/nestedif/gcc_O2/nestedif.expected index ab48890b6..2eddd390b 100644 --- a/src/test/correct/nestedif/gcc_O2/nestedif.expected +++ b/src/test/correct/nestedif/gcc_O2/nestedif.expected @@ -1,14 +1,14 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var mem: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1896bv64); -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1896bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/nestedif/gcc_no_plt_no_pic/nestedif.expected b/src/test/correct/nestedif/gcc_no_plt_no_pic/nestedif.expected index 55e5d1a3e..33c35d1e9 100644 --- a/src/test/correct/nestedif/gcc_no_plt_no_pic/nestedif.expected +++ b/src/test/correct/nestedif/gcc_no_plt_no_pic/nestedif.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1928bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1928bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,20 +186,20 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 2bv64, true; diff --git a/src/test/correct/nestedif/gcc_pic/nestedif.expected b/src/test/correct/nestedif/gcc_pic/nestedif.expected index 55e5d1a3e..33c35d1e9 100644 --- a/src/test/correct/nestedif/gcc_pic/nestedif.expected +++ b/src/test/correct/nestedif/gcc_pic/nestedif.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1928bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1928bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,20 +186,20 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 2bv64, true; diff --git a/src/test/correct/no_interference_update_x/clang/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/clang/no_interference_update_x.expected index a8845dbc3..65df4fefc 100644 --- a/src/test/correct/no_interference_update_x/clang/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/clang/no_interference_update_x.expected @@ -1,37 +1,37 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $y_addr: bv64; -axiom ($y_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -72,7 +72,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -80,18 +80,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -183,7 +183,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var y_old: bv32; + var y_old: bv32; lmain: R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; diff --git a/src/test/correct/no_interference_update_x/clang_O2/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/clang_O2/no_interference_update_x.expected index 70b301f71..65fd3db2f 100644 --- a/src/test/correct/no_interference_update_x/clang_O2/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/clang_O2/no_interference_update_x.expected @@ -1,37 +1,37 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $y_addr: bv64; -axiom ($y_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -72,7 +72,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -80,18 +80,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -183,7 +183,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var y_old: bv32; + var y_old: bv32; lmain: R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; diff --git a/src/test/correct/no_interference_update_x/clang_no_plt_no_pic/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/clang_no_plt_no_pic/no_interference_update_x.expected index a8845dbc3..65df4fefc 100644 --- a/src/test/correct/no_interference_update_x/clang_no_plt_no_pic/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/clang_no_plt_no_pic/no_interference_update_x.expected @@ -1,37 +1,37 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $y_addr: bv64; -axiom ($y_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -72,7 +72,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -80,18 +80,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -183,7 +183,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var y_old: bv32; + var y_old: bv32; lmain: R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; diff --git a/src/test/correct/no_interference_update_x/clang_pic/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/clang_pic/no_interference_update_x.expected index f6cc2c2b8..cb8100cda 100644 --- a/src/test/correct/no_interference_update_x/clang_pic/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/clang_pic/no_interference_update_x.expected @@ -1,45 +1,45 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $y_addr: bv64; -axiom ($y_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -88,7 +88,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -96,18 +96,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -215,7 +215,7 @@ procedure main() free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { - var y_old: bv32; + var y_old: bv32; lmain: R9, Gamma_R9 := 65536bv64, true; call rely(); diff --git a/src/test/correct/no_interference_update_x/gcc/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/gcc/no_interference_update_x.expected index 861d5ce98..5ddfad626 100644 --- a/src/test/correct/no_interference_update_x/gcc/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/gcc/no_interference_update_x.expected @@ -1,35 +1,35 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -70,7 +70,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -78,18 +78,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -181,7 +181,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var y_old: bv32; + var y_old: bv32; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/no_interference_update_x/gcc_O2/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/gcc_O2/no_interference_update_x.expected index 4e1467783..59cdf8a8b 100644 --- a/src/test/correct/no_interference_update_x/gcc_O2/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/gcc_O2/no_interference_update_x.expected @@ -1,37 +1,37 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -72,7 +72,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -80,18 +80,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -183,7 +183,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var y_old: bv32; + var y_old: bv32; lmain: R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 1bv64, true; diff --git a/src/test/correct/no_interference_update_x/gcc_no_plt_no_pic/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/gcc_no_plt_no_pic/no_interference_update_x.expected index 861d5ce98..5ddfad626 100644 --- a/src/test/correct/no_interference_update_x/gcc_no_plt_no_pic/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/gcc_no_plt_no_pic/no_interference_update_x.expected @@ -1,35 +1,35 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -70,7 +70,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -78,18 +78,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -181,7 +181,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var y_old: bv32; + var y_old: bv32; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/no_interference_update_x/gcc_pic/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/gcc_pic/no_interference_update_x.expected index c9909b307..d687a5a76 100644 --- a/src/test/correct/no_interference_update_x/gcc_pic/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/gcc_pic/no_interference_update_x.expected @@ -1,43 +1,43 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -86,7 +86,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -94,18 +94,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -213,7 +213,7 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var y_old: bv32; + var y_old: bv32; lmain: R0, Gamma_R0 := 65536bv64, true; call rely(); diff --git a/src/test/correct/no_interference_update_y/clang/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/clang/no_interference_update_y.expected index c8c4f47bc..97e3a6585 100644 --- a/src/test/correct/no_interference_update_y/clang/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/clang/no_interference_update_y.expected @@ -1,37 +1,37 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $y_addr: bv64; -axiom ($y_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -72,7 +72,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -80,18 +80,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -183,7 +183,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; diff --git a/src/test/correct/no_interference_update_y/clang_O2/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/clang_O2/no_interference_update_y.expected index 1f7087a27..87f71c5c0 100644 --- a/src/test/correct/no_interference_update_y/clang_O2/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/clang_O2/no_interference_update_y.expected @@ -1,37 +1,37 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $y_addr: bv64; -axiom ($y_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -72,7 +72,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -80,18 +80,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -183,7 +183,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; diff --git a/src/test/correct/no_interference_update_y/clang_no_plt_no_pic/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/clang_no_plt_no_pic/no_interference_update_y.expected index c8c4f47bc..97e3a6585 100644 --- a/src/test/correct/no_interference_update_y/clang_no_plt_no_pic/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/clang_no_plt_no_pic/no_interference_update_y.expected @@ -1,37 +1,37 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $y_addr: bv64; -axiom ($y_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -72,7 +72,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -80,18 +80,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -183,7 +183,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; diff --git a/src/test/correct/no_interference_update_y/clang_pic/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/clang_pic/no_interference_update_y.expected index 0aafc34d3..e4d7d7452 100644 --- a/src/test/correct/no_interference_update_y/clang_pic/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/clang_pic/no_interference_update_y.expected @@ -1,45 +1,45 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $y_addr: bv64; -axiom ($y_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -88,7 +88,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -96,18 +96,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -215,7 +215,7 @@ procedure main() free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R9, Gamma_R9 := 65536bv64, true; call rely(); diff --git a/src/test/correct/no_interference_update_y/gcc/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/gcc/no_interference_update_y.expected index 7ea617f8d..794548339 100644 --- a/src/test/correct/no_interference_update_y/gcc/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/gcc/no_interference_update_y.expected @@ -1,35 +1,35 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -70,7 +70,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -78,18 +78,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -181,7 +181,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; diff --git a/src/test/correct/no_interference_update_y/gcc_O2/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/gcc_O2/no_interference_update_y.expected index 25986a697..dfdfc1b45 100644 --- a/src/test/correct/no_interference_update_y/gcc_O2/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/gcc_O2/no_interference_update_y.expected @@ -1,37 +1,37 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69656bv64); -const $y_addr: bv64; -axiom ($y_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69656bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -72,7 +72,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -80,18 +80,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -183,7 +183,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 1bv64, true; diff --git a/src/test/correct/no_interference_update_y/gcc_no_plt_no_pic/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/gcc_no_plt_no_pic/no_interference_update_y.expected index 7ea617f8d..794548339 100644 --- a/src/test/correct/no_interference_update_y/gcc_no_plt_no_pic/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/gcc_no_plt_no_pic/no_interference_update_y.expected @@ -1,35 +1,35 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -70,7 +70,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -78,18 +78,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -181,7 +181,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; diff --git a/src/test/correct/no_interference_update_y/gcc_pic/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/gcc_pic/no_interference_update_y.expected index 40c5f15c7..227bf3abe 100644 --- a/src/test/correct/no_interference_update_y/gcc_pic/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/gcc_pic/no_interference_update_y.expected @@ -1,43 +1,43 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $y_addr: bv64; -axiom ($y_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom {:extern } ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -86,7 +86,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -94,18 +94,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -213,7 +213,7 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: R0, Gamma_R0 := 65536bv64, true; call rely(); diff --git a/src/test/correct/secret_write/clang/secret_write.expected b/src/test/correct/secret_write/clang/secret_write.expected index 429086b06..b90e31b4a 100644 --- a/src/test/correct/secret_write/clang/secret_write.expected +++ b/src/test/correct/secret_write/clang/secret_write.expected @@ -1,49 +1,49 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69688bv64); -const $x_addr: bv64; -axiom ($x_addr == 69692bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69688bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69692bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -85,7 +85,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -94,19 +94,19 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R8, R9, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $z_addr) == true); @@ -201,8 +201,8 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/secret_write/clang_O2/secret_write.expected b/src/test/correct/secret_write/clang_O2/secret_write.expected index 4d3b532df..30ca2a333 100644 --- a/src/test/correct/secret_write/clang_O2/secret_write.expected +++ b/src/test/correct/secret_write/clang_O2/secret_write.expected @@ -1,47 +1,47 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69688bv64); -const $x_addr: bv64; -axiom ($x_addr == 69692bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69688bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69692bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -83,7 +83,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -92,19 +92,19 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R8, R9, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $z_addr) == true); @@ -199,8 +199,8 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; diff --git a/src/test/correct/secret_write/clang_no_plt_no_pic/secret_write.expected b/src/test/correct/secret_write/clang_no_plt_no_pic/secret_write.expected index 429086b06..b90e31b4a 100644 --- a/src/test/correct/secret_write/clang_no_plt_no_pic/secret_write.expected +++ b/src/test/correct/secret_write/clang_no_plt_no_pic/secret_write.expected @@ -1,49 +1,49 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69688bv64); -const $x_addr: bv64; -axiom ($x_addr == 69692bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69688bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69692bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -85,7 +85,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -94,19 +94,19 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R8, R9, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $z_addr) == true); @@ -201,8 +201,8 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/secret_write/clang_pic/secret_write.expected b/src/test/correct/secret_write/clang_pic/secret_write.expected index 5d1a5fc2d..d367354d4 100644 --- a/src/test/correct/secret_write/clang_pic/secret_write.expected +++ b/src/test/correct/secret_write/clang_pic/secret_write.expected @@ -1,57 +1,57 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69688bv64); -const $x_addr: bv64; -axiom ($x_addr == 69692bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69688bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69692bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -117,7 +117,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69566bv64) == 0bv8); free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -126,19 +126,19 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R8, R9, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $z_addr) == true); @@ -281,8 +281,8 @@ procedure main() free ensures (memory_load8_le(mem, 69566bv64) == 0bv8); free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: R9, Gamma_R9 := 65536bv64, true; call rely(); diff --git a/src/test/correct/secret_write/gcc/secret_write.expected b/src/test/correct/secret_write/gcc/secret_write.expected index 162db427a..4dfd5ef1f 100644 --- a/src/test/correct/secret_write/gcc/secret_write.expected +++ b/src/test/correct/secret_write/gcc/secret_write.expected @@ -1,45 +1,45 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69660bv64); -const $x_addr: bv64; -axiom ($x_addr == 69656bv64); -const $z_addr: bv64; -axiom ($z_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69660bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69656bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -81,7 +81,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -90,19 +90,19 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $z_addr) == true); @@ -197,8 +197,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/secret_write/gcc_O2/secret_write.expected b/src/test/correct/secret_write/gcc_O2/secret_write.expected index 4e97fe80d..bba53ca31 100644 --- a/src/test/correct/secret_write/gcc_O2/secret_write.expected +++ b/src/test/correct/secret_write/gcc_O2/secret_write.expected @@ -1,47 +1,47 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_R3: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var R3: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69660bv64); -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R3: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R3: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69660bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -83,7 +83,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -92,19 +92,19 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R3, Gamma_mem, R0, R1, R2, R3, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $z_addr) == true); @@ -199,8 +199,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; diff --git a/src/test/correct/secret_write/gcc_no_plt_no_pic/secret_write.expected b/src/test/correct/secret_write/gcc_no_plt_no_pic/secret_write.expected index 162db427a..4dfd5ef1f 100644 --- a/src/test/correct/secret_write/gcc_no_plt_no_pic/secret_write.expected +++ b/src/test/correct/secret_write/gcc_no_plt_no_pic/secret_write.expected @@ -1,45 +1,45 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69660bv64); -const $x_addr: bv64; -axiom ($x_addr == 69656bv64); -const $z_addr: bv64; -axiom ($z_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69660bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69656bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -81,7 +81,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -90,19 +90,19 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $z_addr) == true); @@ -197,8 +197,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/secret_write/gcc_pic/secret_write.expected b/src/test/correct/secret_write/gcc_pic/secret_write.expected index 332031ef7..dfa86e408 100644 --- a/src/test/correct/secret_write/gcc_pic/secret_write.expected +++ b/src/test/correct/secret_write/gcc_pic/secret_write.expected @@ -1,53 +1,53 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69660bv64); -const $x_addr: bv64; -axiom ($x_addr == 69656bv64); -const $z_addr: bv64; -axiom ($z_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69660bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69656bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -113,7 +113,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -122,19 +122,19 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $z_addr) == true); @@ -277,8 +277,8 @@ procedure main() free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: R0, Gamma_R0 := 65536bv64, true; call rely(); diff --git a/src/test/correct/simple_jump/clang/simple_jump.expected b/src/test/correct/simple_jump/clang/simple_jump.expected index d410505a4..02618c076 100644 --- a/src/test/correct/simple_jump/clang/simple_jump.expected +++ b/src/test/correct/simple_jump/clang/simple_jump.expected @@ -1,46 +1,46 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1892bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1892bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -188,16 +188,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/simple_jump/clang_O2/simple_jump.expected b/src/test/correct/simple_jump/clang_O2/simple_jump.expected index 1e9764f80..5f6aef7e1 100644 --- a/src/test/correct/simple_jump/clang_O2/simple_jump.expected +++ b/src/test/correct/simple_jump/clang_O2/simple_jump.expected @@ -1,14 +1,14 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var mem: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1840bv64); -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1840bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/correct/simple_jump/clang_no_plt_no_pic/simple_jump.expected b/src/test/correct/simple_jump/clang_no_plt_no_pic/simple_jump.expected index 21593dc1c..f4abe0b1a 100644 --- a/src/test/correct/simple_jump/clang_no_plt_no_pic/simple_jump.expected +++ b/src/test/correct/simple_jump/clang_no_plt_no_pic/simple_jump.expected @@ -1,46 +1,46 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1892bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1892bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -188,16 +188,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/simple_jump/clang_pic/simple_jump.expected b/src/test/correct/simple_jump/clang_pic/simple_jump.expected index 21593dc1c..f4abe0b1a 100644 --- a/src/test/correct/simple_jump/clang_pic/simple_jump.expected +++ b/src/test/correct/simple_jump/clang_pic/simple_jump.expected @@ -1,46 +1,46 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1892bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1892bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -188,16 +188,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/simple_jump/gcc/simple_jump.expected b/src/test/correct/simple_jump/gcc/simple_jump.expected index 207f613d1..40ecd3f23 100644 --- a/src/test/correct/simple_jump/gcc/simple_jump.expected +++ b/src/test/correct/simple_jump/gcc/simple_jump.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1876bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1876bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,16 +186,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 5bv64, true; diff --git a/src/test/correct/simple_jump/gcc_O2/simple_jump.expected b/src/test/correct/simple_jump/gcc_O2/simple_jump.expected index ab48890b6..2eddd390b 100644 --- a/src/test/correct/simple_jump/gcc_O2/simple_jump.expected +++ b/src/test/correct/simple_jump/gcc_O2/simple_jump.expected @@ -1,14 +1,14 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var mem: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1896bv64); -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1896bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/simple_jump/gcc_no_plt_no_pic/simple_jump.expected b/src/test/correct/simple_jump/gcc_no_plt_no_pic/simple_jump.expected index a401fed9f..062719163 100644 --- a/src/test/correct/simple_jump/gcc_no_plt_no_pic/simple_jump.expected +++ b/src/test/correct/simple_jump/gcc_no_plt_no_pic/simple_jump.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1876bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1876bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,16 +186,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 5bv64, true; diff --git a/src/test/correct/simple_jump/gcc_pic/simple_jump.expected b/src/test/correct/simple_jump/gcc_pic/simple_jump.expected index a401fed9f..062719163 100644 --- a/src/test/correct/simple_jump/gcc_pic/simple_jump.expected +++ b/src/test/correct/simple_jump/gcc_pic/simple_jump.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1876bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1876bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,16 +186,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 5bv64, true; diff --git a/src/test/correct/switch/clang/switch.expected b/src/test/correct/switch/clang/switch.expected index 1ddf91658..6f7e9c47f 100644 --- a/src/test/correct/switch/clang/switch.expected +++ b/src/test/correct/switch/clang/switch.expected @@ -1,44 +1,44 @@ -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1936bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1936bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R31, Gamma_R8, Gamma_stack, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -186,18 +186,18 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 1bv64, true; diff --git a/src/test/correct/switch/clang_O2/switch.expected b/src/test/correct/switch/clang_O2/switch.expected index 8637d2c74..91a00d7c9 100644 --- a/src/test/correct/switch/clang_O2/switch.expected +++ b/src/test/correct/switch/clang_O2/switch.expected @@ -1,12 +1,12 @@ -var Gamma_mem: [bv64]bool; -var mem: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1836bv64); -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1836bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -47,7 +47,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,12 +56,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); free requires (memory_load8_le(mem, 69666bv64) == 0bv8); diff --git a/src/test/correct/switch/clang_no_plt_no_pic/switch.expected b/src/test/correct/switch/clang_no_plt_no_pic/switch.expected index 71d069297..d1ad70d36 100644 --- a/src/test/correct/switch/clang_no_plt_no_pic/switch.expected +++ b/src/test/correct/switch/clang_no_plt_no_pic/switch.expected @@ -1,44 +1,44 @@ -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1936bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1936bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R31, Gamma_R8, Gamma_stack, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -186,18 +186,18 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 1bv64, true; diff --git a/src/test/correct/switch/clang_pic/switch.expected b/src/test/correct/switch/clang_pic/switch.expected index 71d069297..d1ad70d36 100644 --- a/src/test/correct/switch/clang_pic/switch.expected +++ b/src/test/correct/switch/clang_pic/switch.expected @@ -1,44 +1,44 @@ -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1936bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1936bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R31, Gamma_R8, Gamma_stack, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -186,18 +186,18 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 1bv64, true; diff --git a/src/test/correct/switch/gcc/switch.expected b/src/test/correct/switch/gcc/switch.expected index 4953b28c9..adc61ee66 100644 --- a/src/test/correct/switch/gcc/switch.expected +++ b/src/test/correct/switch/gcc/switch.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1916bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1916bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,18 +186,18 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 1bv64, true; diff --git a/src/test/correct/switch/gcc_O2/switch.expected b/src/test/correct/switch/gcc_O2/switch.expected index a86190f67..db9ab2b08 100644 --- a/src/test/correct/switch/gcc_O2/switch.expected +++ b/src/test/correct/switch/gcc_O2/switch.expected @@ -1,12 +1,12 @@ -var Gamma_mem: [bv64]bool; -var mem: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1896bv64); -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1896bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -47,7 +47,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,12 +56,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); free requires (memory_load8_le(mem, 69634bv64) == 0bv8); diff --git a/src/test/correct/switch/gcc_no_plt_no_pic/switch.expected b/src/test/correct/switch/gcc_no_plt_no_pic/switch.expected index c648c415f..4ebf8fed5 100644 --- a/src/test/correct/switch/gcc_no_plt_no_pic/switch.expected +++ b/src/test/correct/switch/gcc_no_plt_no_pic/switch.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1916bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1916bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,18 +186,18 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 1bv64, true; diff --git a/src/test/correct/switch/gcc_pic/switch.expected b/src/test/correct/switch/gcc_pic/switch.expected index c648c415f..4ebf8fed5 100644 --- a/src/test/correct/switch/gcc_pic/switch.expected +++ b/src/test/correct/switch/gcc_pic/switch.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1916bv64); -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1916bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,18 +186,18 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 1bv64, true; diff --git a/src/test/correct/switch2/clang_O2/switch2.expected b/src/test/correct/switch2/clang_O2/switch2.expected index bdb8ef7ef..ed0d9f14a 100644 --- a/src/test/correct/switch2/clang_O2/switch2.expected +++ b/src/test/correct/switch2/clang_O2/switch2.expected @@ -1,11 +1,11 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var mem: [bv64]bv8; -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } mem: [bv64]bv8; +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -46,7 +46,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -55,12 +55,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/correct/switch2/gcc/switch2.expected b/src/test/correct/switch2/gcc/switch2.expected index afd6b963a..e5b0696b4 100644 --- a/src/test/correct/switch2/gcc/switch2.expected +++ b/src/test/correct/switch2/gcc/switch2.expected @@ -1,65 +1,65 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,7 +100,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,12 +109,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R29, R30, R31, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -210,32 +210,32 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #10: bv32; - var #11: bv32; - var #12: bv32; - var #4: bv64; - var #5: bv32; - var #6: bv32; - var #7: bv32; - var #8: bv32; - var #9: bv32; - var CF: bv1; - var Gamma_#10: bool; - var Gamma_#11: bool; - var Gamma_#12: bool; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_#7: bool; - var Gamma_#8: bool; - var Gamma_#9: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #10: bv32; + var #11: bv32; + var #12: bv32; + var #4: bv64; + var #5: bv32; + var #6: bv32; + var #7: bv32; + var #8: bv32; + var #9: bv32; + var CF: bv1; + var Gamma_#10: bool; + var Gamma_#11: bool; + var Gamma_#12: bool; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_#7: bool; + var Gamma_#8: bool; + var Gamma_#9: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -376,7 +376,7 @@ procedure main() return; } -procedure r() +procedure r() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 2032bv64) == 1bv8); free requires (memory_load8_le(mem, 2033bv64) == 0bv8); diff --git a/src/test/correct/switch2/gcc_O2/switch2.expected b/src/test/correct/switch2/gcc_O2/switch2.expected index 1ab56febd..0981e4f48 100644 --- a/src/test/correct/switch2/gcc_O2/switch2.expected +++ b/src/test/correct/switch2/gcc_O2/switch2.expected @@ -1,11 +1,11 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var mem: [bv64]bv8; -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } mem: [bv64]bv8; +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -46,7 +46,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -55,12 +55,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/switch2/gcc_no_plt_no_pic/switch2.expected b/src/test/correct/switch2/gcc_no_plt_no_pic/switch2.expected index 34fe6e456..3ec629a95 100644 --- a/src/test/correct/switch2/gcc_no_plt_no_pic/switch2.expected +++ b/src/test/correct/switch2/gcc_no_plt_no_pic/switch2.expected @@ -1,65 +1,65 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,7 +100,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,12 +109,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R29, R30, R31, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -210,32 +210,32 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #10: bv32; - var #11: bv32; - var #12: bv32; - var #4: bv64; - var #5: bv32; - var #6: bv32; - var #7: bv32; - var #8: bv32; - var #9: bv32; - var CF: bv1; - var Gamma_#10: bool; - var Gamma_#11: bool; - var Gamma_#12: bool; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_#7: bool; - var Gamma_#8: bool; - var Gamma_#9: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #10: bv32; + var #11: bv32; + var #12: bv32; + var #4: bv64; + var #5: bv32; + var #6: bv32; + var #7: bv32; + var #8: bv32; + var #9: bv32; + var CF: bv1; + var Gamma_#10: bool; + var Gamma_#11: bool; + var Gamma_#12: bool; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_#7: bool; + var Gamma_#8: bool; + var Gamma_#9: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -376,7 +376,7 @@ procedure main() return; } -procedure r() +procedure r() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 2032bv64) == 1bv8); free requires (memory_load8_le(mem, 2033bv64) == 0bv8); diff --git a/src/test/correct/switch2/gcc_pic/switch2.expected b/src/test/correct/switch2/gcc_pic/switch2.expected index 34fe6e456..3ec629a95 100644 --- a/src/test/correct/switch2/gcc_pic/switch2.expected +++ b/src/test/correct/switch2/gcc_pic/switch2.expected @@ -1,65 +1,65 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,7 +100,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,12 +109,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R29, R30, R31, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -210,32 +210,32 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #10: bv32; - var #11: bv32; - var #12: bv32; - var #4: bv64; - var #5: bv32; - var #6: bv32; - var #7: bv32; - var #8: bv32; - var #9: bv32; - var CF: bv1; - var Gamma_#10: bool; - var Gamma_#11: bool; - var Gamma_#12: bool; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_#7: bool; - var Gamma_#8: bool; - var Gamma_#9: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #10: bv32; + var #11: bv32; + var #12: bv32; + var #4: bv64; + var #5: bv32; + var #6: bv32; + var #7: bv32; + var #8: bv32; + var #9: bv32; + var CF: bv1; + var Gamma_#10: bool; + var Gamma_#11: bool; + var Gamma_#12: bool; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_#7: bool; + var Gamma_#8: bool; + var Gamma_#9: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -376,7 +376,7 @@ procedure main() return; } -procedure r() +procedure r() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 2032bv64) == 1bv8); free requires (memory_load8_le(mem, 2033bv64) == 0bv8); diff --git a/src/test/correct/syscall/clang/syscall.expected b/src/test/correct/syscall/clang/syscall.expected index de88ed4c3..963b64a1b 100644 --- a/src/test/correct/syscall/clang/syscall.expected +++ b/src/test/correct/syscall/clang/syscall.expected @@ -1,62 +1,62 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1944bv64); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1944bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,12 +106,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure fork(); +procedure fork(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1944bv64) == 1bv8); free requires (memory_load8_le(mem, 1945bv64) == 0bv8); @@ -186,7 +186,7 @@ procedure fork(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -281,10 +281,10 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; diff --git a/src/test/correct/syscall/clang_no_plt_no_pic/syscall.expected b/src/test/correct/syscall/clang_no_plt_no_pic/syscall.expected index dc9bcaa16..b16b7a269 100644 --- a/src/test/correct/syscall/clang_no_plt_no_pic/syscall.expected +++ b/src/test/correct/syscall/clang_no_plt_no_pic/syscall.expected @@ -1,62 +1,62 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1944bv64); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1944bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,12 +106,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure fork(); +procedure fork(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1944bv64) == 1bv8); free requires (memory_load8_le(mem, 1945bv64) == 0bv8); @@ -186,7 +186,7 @@ procedure fork(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -281,10 +281,10 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; diff --git a/src/test/correct/syscall/clang_pic/syscall.expected b/src/test/correct/syscall/clang_pic/syscall.expected index dc9bcaa16..b16b7a269 100644 --- a/src/test/correct/syscall/clang_pic/syscall.expected +++ b/src/test/correct/syscall/clang_pic/syscall.expected @@ -1,62 +1,62 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1944bv64); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1944bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,12 +106,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure fork(); +procedure fork(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1944bv64) == 1bv8); free requires (memory_load8_le(mem, 1945bv64) == 0bv8); @@ -186,7 +186,7 @@ procedure fork(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -281,10 +281,10 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; diff --git a/src/test/correct/syscall/gcc/syscall.expected b/src/test/correct/syscall/gcc/syscall.expected index f12cfc259..28bfcaccb 100644 --- a/src/test/correct/syscall/gcc/syscall.expected +++ b/src/test/correct/syscall/gcc/syscall.expected @@ -1,62 +1,62 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1932bv64); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1932bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,12 +106,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure fork(); +procedure fork(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1932bv64) == 1bv8); free requires (memory_load8_le(mem, 1933bv64) == 0bv8); @@ -186,7 +186,7 @@ procedure fork(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -281,8 +281,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); diff --git a/src/test/correct/syscall/gcc_O2/syscall.expected b/src/test/correct/syscall/gcc_O2/syscall.expected index 04b6a3257..3721f3ecb 100644 --- a/src/test/correct/syscall/gcc_O2/syscall.expected +++ b/src/test/correct/syscall/gcc_O2/syscall.expected @@ -1,16 +1,16 @@ -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_mem: [bv64]bool; -var R16: bv64; -var R17: bv64; -var mem: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1960bv64); -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1960bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -51,7 +51,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -60,12 +60,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure fork(); +procedure fork(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/syscall/gcc_no_plt_no_pic/syscall.expected b/src/test/correct/syscall/gcc_no_plt_no_pic/syscall.expected index 7052244b3..4d053ce92 100644 --- a/src/test/correct/syscall/gcc_no_plt_no_pic/syscall.expected +++ b/src/test/correct/syscall/gcc_no_plt_no_pic/syscall.expected @@ -1,62 +1,62 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1932bv64); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1932bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,12 +106,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure fork(); +procedure fork(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1932bv64) == 1bv8); free requires (memory_load8_le(mem, 1933bv64) == 0bv8); @@ -186,7 +186,7 @@ procedure fork(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -281,8 +281,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); diff --git a/src/test/correct/syscall/gcc_pic/syscall.expected b/src/test/correct/syscall/gcc_pic/syscall.expected index 7052244b3..4d053ce92 100644 --- a/src/test/correct/syscall/gcc_pic/syscall.expected +++ b/src/test/correct/syscall/gcc_pic/syscall.expected @@ -1,62 +1,62 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R16: bool; -var Gamma_R17: bool; -var Gamma_R29: bool; -var Gamma_R30: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R16: bv64; -var R17: bv64; -var R29: bv64; -var R30: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $_IO_stdin_used_addr: bv64; -axiom ($_IO_stdin_used_addr == 1932bv64); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom {:extern } ($_IO_stdin_used_addr == 1932bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,12 +106,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure fork(); +procedure fork(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1932bv64) == 1bv8); free requires (memory_load8_le(mem, 1933bv64) == 0bv8); @@ -186,7 +186,7 @@ procedure fork(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -281,8 +281,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); diff --git a/src/test/correct/using_gamma_conditional/clang/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/clang/using_gamma_conditional.expected index f4d0f8017..22fdbb950 100644 --- a/src/test/correct/using_gamma_conditional/clang/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/clang/using_gamma_conditional.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -87,7 +87,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -95,18 +95,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -200,16 +200,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/using_gamma_conditional/clang_O2/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/clang_O2/using_gamma_conditional.expected index f162af5da..168de6b0c 100644 --- a/src/test/correct/using_gamma_conditional/clang_O2/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/clang_O2/using_gamma_conditional.expected @@ -1,40 +1,40 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -75,7 +75,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -83,18 +83,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_mem, R0, R8, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -186,16 +186,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R8, Gamma_R8 := 69632bv64, true; call rely(); diff --git a/src/test/correct/using_gamma_conditional/clang_no_plt_no_pic/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/clang_no_plt_no_pic/using_gamma_conditional.expected index 0bb52e57a..c29922767 100644 --- a/src/test/correct/using_gamma_conditional/clang_no_plt_no_pic/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/clang_no_plt_no_pic/using_gamma_conditional.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -87,7 +87,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -95,18 +95,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -200,16 +200,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/using_gamma_conditional/clang_pic/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/clang_pic/using_gamma_conditional.expected index c741aa67b..95fd3d718 100644 --- a/src/test/correct/using_gamma_conditional/clang_pic/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/clang_pic/using_gamma_conditional.expected @@ -1,60 +1,60 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69684bv64); -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -103,7 +103,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -111,18 +111,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -232,16 +232,16 @@ procedure main() free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/correct/using_gamma_conditional/gcc/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/gcc/using_gamma_conditional.expected index df1a346eb..12163b705 100644 --- a/src/test/correct/using_gamma_conditional/gcc/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/gcc/using_gamma_conditional.expected @@ -1,38 +1,38 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -73,7 +73,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -81,18 +81,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_mem, R0, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -184,16 +184,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/using_gamma_conditional/gcc_O2/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/gcc_O2/using_gamma_conditional.expected index 1991c20a8..01a4117f8 100644 --- a/src/test/correct/using_gamma_conditional/gcc_O2/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/gcc_O2/using_gamma_conditional.expected @@ -1,38 +1,38 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -73,7 +73,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -81,18 +81,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_mem, R0, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -184,16 +184,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv32; - var CF: bv1; - var Gamma_#1: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #1: bv32; + var CF: bv1; + var Gamma_#1: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R0, Gamma_R0 := 69632bv64, true; call rely(); diff --git a/src/test/correct/using_gamma_conditional/gcc_no_plt_no_pic/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/gcc_no_plt_no_pic/using_gamma_conditional.expected index 8d6ed7a5a..c9fd53c65 100644 --- a/src/test/correct/using_gamma_conditional/gcc_no_plt_no_pic/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/gcc_no_plt_no_pic/using_gamma_conditional.expected @@ -1,38 +1,38 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -73,7 +73,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -81,18 +81,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_mem, R0, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -184,16 +184,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; diff --git a/src/test/correct/using_gamma_conditional/gcc_pic/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/gcc_pic/using_gamma_conditional.expected index cf6db78d2..c2f2a74f1 100644 --- a/src/test/correct/using_gamma_conditional/gcc_pic/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/gcc_pic/using_gamma_conditional.expected @@ -1,46 +1,46 @@ -var Gamma_R0: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -89,7 +89,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -97,18 +97,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_mem, R0, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -216,16 +216,16 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R0, Gamma_R0 := 65536bv64, true; call rely(); diff --git a/src/test/correct/using_gamma_write_z/clang/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/clang/using_gamma_write_z.expected index 9a38996b7..773db35a9 100644 --- a/src/test/correct/using_gamma_write_z/clang/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/clang/using_gamma_write_z.expected @@ -1,41 +1,41 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -76,7 +76,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -84,18 +84,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires ((memory_load32_le(mem, $z_addr) == 0bv32) ==> gamma_load32(Gamma_mem, $x_addr)); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -187,7 +187,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; + var Gamma_x_old: bool; lmain: R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; diff --git a/src/test/correct/using_gamma_write_z/clang_O2/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/clang_O2/using_gamma_write_z.expected index fddf32d04..053777c1a 100644 --- a/src/test/correct/using_gamma_write_z/clang_O2/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/clang_O2/using_gamma_write_z.expected @@ -1,41 +1,41 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -76,7 +76,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -84,18 +84,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires ((memory_load32_le(mem, $z_addr) == 0bv32) ==> gamma_load32(Gamma_mem, $x_addr)); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -187,7 +187,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; + var Gamma_x_old: bool; lmain: R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; diff --git a/src/test/correct/using_gamma_write_z/clang_no_plt_no_pic/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/clang_no_plt_no_pic/using_gamma_write_z.expected index 9a38996b7..773db35a9 100644 --- a/src/test/correct/using_gamma_write_z/clang_no_plt_no_pic/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/clang_no_plt_no_pic/using_gamma_write_z.expected @@ -1,41 +1,41 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -76,7 +76,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -84,18 +84,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires ((memory_load32_le(mem, $z_addr) == 0bv32) ==> gamma_load32(Gamma_mem, $x_addr)); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -187,7 +187,7 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; + var Gamma_x_old: bool; lmain: R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; diff --git a/src/test/correct/using_gamma_write_z/clang_pic/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/clang_pic/using_gamma_write_z.expected index bf7fd1eb8..fd247c995 100644 --- a/src/test/correct/using_gamma_write_z/clang_pic/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/clang_pic/using_gamma_write_z.expected @@ -1,49 +1,49 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69684bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -92,7 +92,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -100,18 +100,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires ((memory_load32_le(mem, $z_addr) == 0bv32) ==> gamma_load32(Gamma_mem, $x_addr)); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -219,7 +219,7 @@ procedure main() free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { - var Gamma_x_old: bool; + var Gamma_x_old: bool; lmain: R9, Gamma_R9 := 65536bv64, true; call rely(); diff --git a/src/test/correct/using_gamma_write_z/gcc/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/gcc/using_gamma_write_z.expected index d16cac0c0..992a9b6a2 100644 --- a/src/test/correct/using_gamma_write_z/gcc/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/gcc/using_gamma_write_z.expected @@ -1,39 +1,39 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -74,7 +74,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -82,18 +82,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires ((memory_load32_le(mem, $z_addr) == 0bv32) ==> gamma_load32(Gamma_mem, $x_addr)); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -185,7 +185,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; + var Gamma_x_old: bool; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; diff --git a/src/test/correct/using_gamma_write_z/gcc_O2/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/gcc_O2/using_gamma_write_z.expected index c261dfc76..ff75843be 100644 --- a/src/test/correct/using_gamma_write_z/gcc_O2/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/gcc_O2/using_gamma_write_z.expected @@ -1,41 +1,41 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69656bv64); -const $z_addr: bv64; -axiom ($z_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69656bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -76,7 +76,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -84,18 +84,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; requires ((memory_load32_le(mem, $z_addr) == 0bv32) ==> gamma_load32(Gamma_mem, $x_addr)); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -187,7 +187,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; + var Gamma_x_old: bool; lmain: R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 1bv64, true; diff --git a/src/test/correct/using_gamma_write_z/gcc_no_plt_no_pic/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/gcc_no_plt_no_pic/using_gamma_write_z.expected index d16cac0c0..992a9b6a2 100644 --- a/src/test/correct/using_gamma_write_z/gcc_no_plt_no_pic/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/gcc_no_plt_no_pic/using_gamma_write_z.expected @@ -1,39 +1,39 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -74,7 +74,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -82,18 +82,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires ((memory_load32_le(mem, $z_addr) == 0bv32) ==> gamma_load32(Gamma_mem, $x_addr)); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -185,7 +185,7 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; + var Gamma_x_old: bool; lmain: R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; diff --git a/src/test/correct/using_gamma_write_z/gcc_pic/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/gcc_pic/using_gamma_write_z.expected index 0346aadea..01b4c71d9 100644 --- a/src/test/correct/using_gamma_write_z/gcc_pic/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/gcc_pic/using_gamma_write_z.expected @@ -1,47 +1,47 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -90,7 +90,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -98,18 +98,18 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires ((memory_load32_le(mem, $z_addr) == 0bv32) ==> gamma_load32(Gamma_mem, $x_addr)); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -217,7 +217,7 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var Gamma_x_old: bool; + var Gamma_x_old: bool; lmain: R0, Gamma_R0 := 65536bv64, true; call rely(); diff --git a/src/test/incorrect/basicassign/clang/basicassign.expected b/src/test/incorrect/basicassign/clang/basicassign.expected index 3898c9ef8..1f0dc70e5 100644 --- a/src/test/incorrect/basicassign/clang/basicassign.expected +++ b/src/test/incorrect/basicassign/clang/basicassign.expected @@ -1,48 +1,48 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R11: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R11: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69684bv64); -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69692bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R11: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R11: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69684bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69692bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -83,7 +83,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -91,15 +91,15 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R11, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R11, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign/clang_O2/basicassign.expected b/src/test/incorrect/basicassign/clang_O2/basicassign.expected index bb9e905d2..15f1e50a5 100644 --- a/src/test/incorrect/basicassign/clang_O2/basicassign.expected +++ b/src/test/incorrect/basicassign/clang_O2/basicassign.expected @@ -1,46 +1,46 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69684bv64); -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69692bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69684bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69692bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -81,7 +81,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -89,15 +89,15 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign/clang_no_plt_no_pic/basicassign.expected b/src/test/incorrect/basicassign/clang_no_plt_no_pic/basicassign.expected index 3898c9ef8..1f0dc70e5 100644 --- a/src/test/incorrect/basicassign/clang_no_plt_no_pic/basicassign.expected +++ b/src/test/incorrect/basicassign/clang_no_plt_no_pic/basicassign.expected @@ -1,48 +1,48 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R11: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R11: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69684bv64); -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69692bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R11: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R11: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69684bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69692bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -83,7 +83,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -91,15 +91,15 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R11, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R11, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign/clang_pic/basicassign.expected b/src/test/incorrect/basicassign/clang_pic/basicassign.expected index 5a362163e..9331c2d78 100644 --- a/src/test/incorrect/basicassign/clang_pic/basicassign.expected +++ b/src/test/incorrect/basicassign/clang_pic/basicassign.expected @@ -1,56 +1,56 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R11: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R11: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69684bv64); -const $x_addr: bv64; -axiom ($x_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69692bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R11: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R11: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69684bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69692bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -115,7 +115,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69566bv64) == 0bv8); free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -123,15 +123,15 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R11, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R11, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign/gcc/basicassign.expected b/src/test/incorrect/basicassign/gcc/basicassign.expected index b184d930c..0c1790ecb 100644 --- a/src/test/incorrect/basicassign/gcc/basicassign.expected +++ b/src/test/incorrect/basicassign/gcc/basicassign.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69660bv64); -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69660bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -77,7 +77,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -85,15 +85,15 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign/gcc_O2/basicassign.expected b/src/test/incorrect/basicassign/gcc_O2/basicassign.expected index d19045adc..b2f1dce40 100644 --- a/src/test/incorrect/basicassign/gcc_O2/basicassign.expected +++ b/src/test/incorrect/basicassign/gcc_O2/basicassign.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69652bv64); -const $x_addr: bv64; -axiom ($x_addr == 69656bv64); -const $z_addr: bv64; -axiom ($z_addr == 69660bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69652bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69656bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69660bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -87,15 +87,15 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,8 +186,8 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv64; - var Gamma_#1: bool; + var #1: bv64; + var Gamma_#1: bool; lmain: R2, Gamma_R2 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R2, 20bv64), Gamma_R2; diff --git a/src/test/incorrect/basicassign/gcc_no_plt_no_pic/basicassign.expected b/src/test/incorrect/basicassign/gcc_no_plt_no_pic/basicassign.expected index b184d930c..0c1790ecb 100644 --- a/src/test/incorrect/basicassign/gcc_no_plt_no_pic/basicassign.expected +++ b/src/test/incorrect/basicassign/gcc_no_plt_no_pic/basicassign.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69660bv64); -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69660bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -77,7 +77,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -85,15 +85,15 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign/gcc_pic/basicassign.expected b/src/test/incorrect/basicassign/gcc_pic/basicassign.expected index 16ae5f224..2dbb60da7 100644 --- a/src/test/incorrect/basicassign/gcc_pic/basicassign.expected +++ b/src/test/incorrect/basicassign/gcc_pic/basicassign.expected @@ -1,50 +1,50 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69660bv64); -const $x_addr: bv64; -axiom ($x_addr == 69652bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69660bv64); +const {:extern } $x_addr: bv64; +axiom {:extern } ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -109,7 +109,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -117,15 +117,15 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign1/clang/basicassign1.expected b/src/test/incorrect/basicassign1/clang/basicassign1.expected index 49af47157..ec729c971 100644 --- a/src/test/incorrect/basicassign1/clang/basicassign1.expected +++ b/src/test/incorrect/basicassign1/clang/basicassign1.expected @@ -1,46 +1,46 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign1/clang_O2/basicassign1.expected b/src/test/incorrect/basicassign1/clang_O2/basicassign1.expected index 246156a06..84abb6e54 100644 --- a/src/test/incorrect/basicassign1/clang_O2/basicassign1.expected +++ b/src/test/incorrect/basicassign1/clang_O2/basicassign1.expected @@ -1,40 +1,40 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,12 +84,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign1/clang_no_plt_no_pic/basicassign1.expected b/src/test/incorrect/basicassign1/clang_no_plt_no_pic/basicassign1.expected index 49af47157..ec729c971 100644 --- a/src/test/incorrect/basicassign1/clang_no_plt_no_pic/basicassign1.expected +++ b/src/test/incorrect/basicassign1/clang_no_plt_no_pic/basicassign1.expected @@ -1,46 +1,46 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign1/clang_pic/basicassign1.expected b/src/test/incorrect/basicassign1/clang_pic/basicassign1.expected index 2e0678777..38e80443e 100644 --- a/src/test/incorrect/basicassign1/clang_pic/basicassign1.expected +++ b/src/test/incorrect/basicassign1/clang_pic/basicassign1.expected @@ -1,54 +1,54 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -105,7 +105,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -114,12 +114,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign1/gcc/basicassign1.expected b/src/test/incorrect/basicassign1/gcc/basicassign1.expected index aeb65fedd..ce0525035 100644 --- a/src/test/incorrect/basicassign1/gcc/basicassign1.expected +++ b/src/test/incorrect/basicassign1/gcc/basicassign1.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $z_addr: bv64; -axiom ($z_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,12 +86,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign1/gcc_O2/basicassign1.expected b/src/test/incorrect/basicassign1/gcc_O2/basicassign1.expected index d3391fd0a..9f34a299e 100644 --- a/src/test/incorrect/basicassign1/gcc_O2/basicassign1.expected +++ b/src/test/incorrect/basicassign1/gcc_O2/basicassign1.expected @@ -1,40 +1,40 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var mem: [bv64]bv8; -const $z_addr: bv64; -axiom ($z_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,12 +84,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign1/gcc_no_plt_no_pic/basicassign1.expected b/src/test/incorrect/basicassign1/gcc_no_plt_no_pic/basicassign1.expected index aeb65fedd..ce0525035 100644 --- a/src/test/incorrect/basicassign1/gcc_no_plt_no_pic/basicassign1.expected +++ b/src/test/incorrect/basicassign1/gcc_no_plt_no_pic/basicassign1.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $z_addr: bv64; -axiom ($z_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,12 +86,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign1/gcc_pic/basicassign1.expected b/src/test/incorrect/basicassign1/gcc_pic/basicassign1.expected index d39d48df5..931d5b735 100644 --- a/src/test/incorrect/basicassign1/gcc_pic/basicassign1.expected +++ b/src/test/incorrect/basicassign1/gcc_pic/basicassign1.expected @@ -1,50 +1,50 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $z_addr: bv64; -axiom ($z_addr == 69652bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,7 +101,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -110,12 +110,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign2/clang/basicassign2.expected b/src/test/incorrect/basicassign2/clang/basicassign2.expected index eac88ceeb..ed6b08561 100644 --- a/src/test/incorrect/basicassign2/clang/basicassign2.expected +++ b/src/test/incorrect/basicassign2/clang/basicassign2.expected @@ -1,47 +1,47 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69696bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69696bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,7 +82,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,12 +91,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign2/clang_O2/basicassign2.expected b/src/test/incorrect/basicassign2/clang_O2/basicassign2.expected index 8cc16eaf9..c7390d655 100644 --- a/src/test/incorrect/basicassign2/clang_O2/basicassign2.expected +++ b/src/test/incorrect/basicassign2/clang_O2/basicassign2.expected @@ -1,41 +1,41 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69696bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69696bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,12 +85,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign2/clang_no_plt_no_pic/basicassign2.expected b/src/test/incorrect/basicassign2/clang_no_plt_no_pic/basicassign2.expected index eac88ceeb..ed6b08561 100644 --- a/src/test/incorrect/basicassign2/clang_no_plt_no_pic/basicassign2.expected +++ b/src/test/incorrect/basicassign2/clang_no_plt_no_pic/basicassign2.expected @@ -1,47 +1,47 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69696bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69696bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,7 +82,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,12 +91,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign2/clang_pic/basicassign2.expected b/src/test/incorrect/basicassign2/clang_pic/basicassign2.expected index 1b5fddca4..572785ea3 100644 --- a/src/test/incorrect/basicassign2/clang_pic/basicassign2.expected +++ b/src/test/incorrect/basicassign2/clang_pic/basicassign2.expected @@ -1,47 +1,47 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69688bv64); -const $z_addr: bv64; -axiom ($z_addr == 69696bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69696bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,7 +98,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -107,12 +107,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign2/gcc/basicassign2.expected b/src/test/incorrect/basicassign2/gcc/basicassign2.expected index 1800cc14a..d6ab9abe6 100644 --- a/src/test/incorrect/basicassign2/gcc/basicassign2.expected +++ b/src/test/incorrect/basicassign2/gcc/basicassign2.expected @@ -1,43 +1,43 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69664bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69664bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -78,7 +78,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,12 +87,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign2/gcc_O2/basicassign2.expected b/src/test/incorrect/basicassign2/gcc_O2/basicassign2.expected index 9162add37..8cf4c92da 100644 --- a/src/test/incorrect/basicassign2/gcc_O2/basicassign2.expected +++ b/src/test/incorrect/basicassign2/gcc_O2/basicassign2.expected @@ -1,41 +1,41 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69664bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69664bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,12 +85,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign2/gcc_no_plt_no_pic/basicassign2.expected b/src/test/incorrect/basicassign2/gcc_no_plt_no_pic/basicassign2.expected index 1800cc14a..d6ab9abe6 100644 --- a/src/test/incorrect/basicassign2/gcc_no_plt_no_pic/basicassign2.expected +++ b/src/test/incorrect/basicassign2/gcc_no_plt_no_pic/basicassign2.expected @@ -1,43 +1,43 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69664bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69664bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -78,7 +78,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,12 +87,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign2/gcc_pic/basicassign2.expected b/src/test/incorrect/basicassign2/gcc_pic/basicassign2.expected index d0af0ffe0..f8a96bad0 100644 --- a/src/test/incorrect/basicassign2/gcc_pic/basicassign2.expected +++ b/src/test/incorrect/basicassign2/gcc_pic/basicassign2.expected @@ -1,43 +1,43 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69664bv64); -const $z_addr: bv64; -axiom ($z_addr == 69656bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69664bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,12 +103,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign3/clang/basicassign3.expected b/src/test/incorrect/basicassign3/clang/basicassign3.expected index 3fe3c6e69..55e019ce2 100644 --- a/src/test/incorrect/basicassign3/clang/basicassign3.expected +++ b/src/test/incorrect/basicassign3/clang/basicassign3.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69681bv64); -const $z_addr: bv64; -axiom ($z_addr == 69682bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69681bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69682bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign3/clang_O2/basicassign3.expected b/src/test/incorrect/basicassign3/clang_O2/basicassign3.expected index 0374fa6a8..6d5a44168 100644 --- a/src/test/incorrect/basicassign3/clang_O2/basicassign3.expected +++ b/src/test/incorrect/basicassign3/clang_O2/basicassign3.expected @@ -1,38 +1,38 @@ -var Gamma_R0: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69684bv64); -const $z_addr: bv64; -axiom ($z_addr == 69688bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,12 +82,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign3/clang_no_plt_no_pic/basicassign3.expected b/src/test/incorrect/basicassign3/clang_no_plt_no_pic/basicassign3.expected index 3fe3c6e69..55e019ce2 100644 --- a/src/test/incorrect/basicassign3/clang_no_plt_no_pic/basicassign3.expected +++ b/src/test/incorrect/basicassign3/clang_no_plt_no_pic/basicassign3.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69681bv64); -const $z_addr: bv64; -axiom ($z_addr == 69682bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69681bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69682bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign3/clang_pic/basicassign3.expected b/src/test/incorrect/basicassign3/clang_pic/basicassign3.expected index 44c4be020..3d210d1e5 100644 --- a/src/test/incorrect/basicassign3/clang_pic/basicassign3.expected +++ b/src/test/incorrect/basicassign3/clang_pic/basicassign3.expected @@ -1,52 +1,52 @@ -var Gamma_R0: bool; -var Gamma_R10: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R10: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69681bv64); -const $z_addr: bv64; -axiom ($z_addr == 69682bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69681bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69682bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,7 +103,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -112,12 +112,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign3/gcc/basicassign3.expected b/src/test/incorrect/basicassign3/gcc/basicassign3.expected index 2f888eea0..a49f59087 100644 --- a/src/test/incorrect/basicassign3/gcc/basicassign3.expected +++ b/src/test/incorrect/basicassign3/gcc/basicassign3.expected @@ -1,40 +1,40 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69650bv64); -const $z_addr: bv64; -axiom ($z_addr == 69649bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69650bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69649bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,12 +84,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign3/gcc_O2/basicassign3.expected b/src/test/incorrect/basicassign3/gcc_O2/basicassign3.expected index 0aca8c217..2ec31149a 100644 --- a/src/test/incorrect/basicassign3/gcc_O2/basicassign3.expected +++ b/src/test/incorrect/basicassign3/gcc_O2/basicassign3.expected @@ -1,38 +1,38 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R2: bool; -var Gamma_mem: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R2: bv64; -var mem: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69650bv64); -const $z_addr: bv64; -axiom ($z_addr == 69649bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69650bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69649bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,12 +82,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign3/gcc_no_plt_no_pic/basicassign3.expected b/src/test/incorrect/basicassign3/gcc_no_plt_no_pic/basicassign3.expected index 2f888eea0..a49f59087 100644 --- a/src/test/incorrect/basicassign3/gcc_no_plt_no_pic/basicassign3.expected +++ b/src/test/incorrect/basicassign3/gcc_no_plt_no_pic/basicassign3.expected @@ -1,40 +1,40 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69650bv64); -const $z_addr: bv64; -axiom ($z_addr == 69649bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69650bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69649bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,12 +84,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/incorrect/basicassign3/gcc_pic/basicassign3.expected b/src/test/incorrect/basicassign3/gcc_pic/basicassign3.expected index bfac2a917..790a28a7a 100644 --- a/src/test/incorrect/basicassign3/gcc_pic/basicassign3.expected +++ b/src/test/incorrect/basicassign3/gcc_pic/basicassign3.expected @@ -1,48 +1,48 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -const $secret_addr: bv64; -axiom ($secret_addr == 69650bv64); -const $z_addr: bv64; -axiom ($z_addr == 69649bv64); -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom {:extern } ($secret_addr == 69650bv64); +const {:extern } $z_addr: bv64; +axiom {:extern } ($z_addr == 69649bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -99,7 +99,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -108,12 +108,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/incorrect/iflocal/clang/iflocal.expected b/src/test/incorrect/iflocal/clang/iflocal.expected index 14a976418..ed1899391 100644 --- a/src/test/incorrect/iflocal/clang/iflocal.expected +++ b/src/test/incorrect/iflocal/clang/iflocal.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -186,16 +186,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/incorrect/iflocal/clang_no_plt_no_pic/iflocal.expected b/src/test/incorrect/iflocal/clang_no_plt_no_pic/iflocal.expected index c1ec5bd48..503ea3a02 100644 --- a/src/test/incorrect/iflocal/clang_no_plt_no_pic/iflocal.expected +++ b/src/test/incorrect/iflocal/clang_no_plt_no_pic/iflocal.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -186,16 +186,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/incorrect/iflocal/clang_pic/iflocal.expected b/src/test/incorrect/iflocal/clang_pic/iflocal.expected index c1ec5bd48..503ea3a02 100644 --- a/src/test/incorrect/iflocal/clang_pic/iflocal.expected +++ b/src/test/incorrect/iflocal/clang_pic/iflocal.expected @@ -1,44 +1,44 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -186,16 +186,16 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/incorrect/iflocal/gcc/iflocal.expected b/src/test/incorrect/iflocal/gcc/iflocal.expected index 6571a03cf..7ec2d4338 100644 --- a/src/test/incorrect/iflocal/gcc/iflocal.expected +++ b/src/test/incorrect/iflocal/gcc/iflocal.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,12 +86,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -184,16 +184,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/incorrect/iflocal/gcc_no_plt_no_pic/iflocal.expected b/src/test/incorrect/iflocal/gcc_no_plt_no_pic/iflocal.expected index 66efa5b8d..76c43f004 100644 --- a/src/test/incorrect/iflocal/gcc_no_plt_no_pic/iflocal.expected +++ b/src/test/incorrect/iflocal/gcc_no_plt_no_pic/iflocal.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,12 +86,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -184,16 +184,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/incorrect/iflocal/gcc_pic/iflocal.expected b/src/test/incorrect/iflocal/gcc_pic/iflocal.expected index 66efa5b8d..76c43f004 100644 --- a/src/test/incorrect/iflocal/gcc_pic/iflocal.expected +++ b/src/test/incorrect/iflocal/gcc_pic/iflocal.expected @@ -1,42 +1,42 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,12 +86,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -184,16 +184,16 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/incorrect/nestedifglobal/clang/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/clang/nestedifglobal.expected index 971a31859..bd481a087 100644 --- a/src/test/incorrect/nestedifglobal/clang/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/clang/nestedifglobal.expected @@ -1,50 +1,50 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,7 +85,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,12 +94,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -192,20 +192,20 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/incorrect/nestedifglobal/clang_no_plt_no_pic/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/clang_no_plt_no_pic/nestedifglobal.expected index 42fc63d91..9a8dfd5ea 100644 --- a/src/test/incorrect/nestedifglobal/clang_no_plt_no_pic/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/clang_no_plt_no_pic/nestedifglobal.expected @@ -1,50 +1,50 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,7 +85,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,12 +94,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -192,20 +192,20 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); diff --git a/src/test/incorrect/nestedifglobal/clang_pic/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/clang_pic/nestedifglobal.expected index b789075b8..4be29dbcc 100644 --- a/src/test/incorrect/nestedifglobal/clang_pic/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/clang_pic/nestedifglobal.expected @@ -1,66 +1,66 @@ -var Gamma_R0: bool; -var Gamma_R31: bool; -var Gamma_R8: bool; -var Gamma_R9: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R31: bv64; -var R8: bv64; -var R9: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -117,7 +117,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -126,12 +126,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -256,20 +256,20 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := 65536bv64, true; diff --git a/src/test/incorrect/nestedifglobal/gcc/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/gcc/nestedifglobal.expected index 843c7dc3c..0dc929fa0 100644 --- a/src/test/incorrect/nestedifglobal/gcc/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/gcc/nestedifglobal.expected @@ -1,48 +1,48 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,7 +83,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,12 +92,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -190,20 +190,20 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/incorrect/nestedifglobal/gcc_no_plt_no_pic/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/gcc_no_plt_no_pic/nestedifglobal.expected index 4e681cfe8..e4413bb14 100644 --- a/src/test/incorrect/nestedifglobal/gcc_no_plt_no_pic/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/gcc_no_plt_no_pic/nestedifglobal.expected @@ -1,48 +1,48 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,7 +83,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,12 +92,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -190,20 +190,20 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); diff --git a/src/test/incorrect/nestedifglobal/gcc_pic/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/gcc_pic/nestedifglobal.expected index 11d772e99..66d18d1b9 100644 --- a/src/test/incorrect/nestedifglobal/gcc_pic/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/gcc_pic/nestedifglobal.expected @@ -1,56 +1,56 @@ -var Gamma_R0: bool; -var Gamma_R1: bool; -var Gamma_R31: bool; -var Gamma_mem: [bv64]bool; -var Gamma_stack: [bv64]bool; -var R0: bv64; -var R1: bv64; -var R31: bv64; -var mem: [bv64]bv8; -var stack: [bv64]bv8; -function L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -107,7 +107,7 @@ procedure rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -116,12 +116,12 @@ procedure rely_transitive() call rely(); } -procedure rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -246,20 +246,20 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); From ea3d08e210ca393bc4ae17d3aaf6679a193a12a1 Mon Sep 17 00:00:00 2001 From: Alistair Michael Date: Fri, 27 Oct 2023 17:16:03 +1000 Subject: [PATCH 02/11] add state split on each block begin, load, and store --- src/main/scala/bap/BAPStatement.scala | 4 +-- src/main/scala/boogie/BCmd.scala | 34 ++++++++++++++++----- src/main/scala/ir/Statement.scala | 18 +++++++---- src/main/scala/ir/Visitor.scala | 10 ++++++ src/main/scala/translating/BAPLoader.scala | 6 ++-- src/main/scala/translating/BAPToIR.scala | 4 +-- src/main/scala/translating/IRToBoogie.scala | 20 ++++++++++-- 7 files changed, 74 insertions(+), 22 deletions(-) diff --git a/src/main/scala/bap/BAPStatement.scala b/src/main/scala/bap/BAPStatement.scala index 9a102e4ef..24f7541fe 100644 --- a/src/main/scala/bap/BAPStatement.scala +++ b/src/main/scala/bap/BAPStatement.scala @@ -32,7 +32,7 @@ trait BAPAssign(lhs: BAPVariable, rhs: BAPExpr, line: String, instruction: Strin /** Memory store */ -case class BAPMemAssign(lhs: BAPMemory, rhs: BAPStore, line: String, instruction: String) +case class BAPMemAssign(lhs: BAPMemory, rhs: BAPStore, line: String, instruction: String, address: Option[Int] = None) extends BAPAssign(lhs, rhs, line, instruction) /* @@ -47,5 +47,5 @@ case object BAPMemAssign { } */ -case class BAPLocalAssign(lhs: BAPVar, rhs: BAPExpr, line: String, instruction: String) +case class BAPLocalAssign(lhs: BAPVar, rhs: BAPExpr, line: String, instruction: String, address: Option[Int] = None) extends BAPAssign(lhs, rhs, line, instruction) diff --git a/src/main/scala/boogie/BCmd.scala b/src/main/scala/boogie/BCmd.scala index 4c48fe30a..b2e3dad56 100644 --- a/src/main/scala/boogie/BCmd.scala +++ b/src/main/scala/boogie/BCmd.scala @@ -15,36 +15,48 @@ case class BBlock(label: String, body: List[BCmd]) extends BCmdOrBlock { override def functionOps: Set[FunctionOp] = body.flatMap(c => c.functionOps).toSet override def locals: Set[BVar] = body.flatMap(c => c.locals).toSet override def globals: Set[BVar] = body.flatMap(c => c.globals).toSet + + } -sealed trait BCmd extends BCmdOrBlock { +sealed trait BCmd() extends BCmdOrBlock { def comment: Option[String] + def attributes: List[(String, String)] + + val attrString: String = if (attributes.nonEmpty) then { + attributes.map(a => s"{${a._1} ${a._2}}").mkString(" ") + } else { + "" + } + override def toBoogie: List[String] = { val commentOut = comment.map(" //" + _).getOrElse("") List(toString + commentOut) } } -case class BAssert(body: BExpr, comment: Option[String] = None) extends BCmd { - override def toString: String = s"assert $body;" +case class BAssert(body: BExpr, comment: Option[String] = None, attributes: List[(String, String)] = List.empty) extends BCmd { + override def toString: String = s"assert $attrString $body;" override def functionOps: Set[FunctionOp] = body.functionOps override def locals: Set[BVar] = body.locals override def globals: Set[BVar] = body.globals } -case class BAssume(body: BExpr, comment: Option[String] = None) extends BCmd { - override def toString: String = s"assume $body;" +case class BAssume(body: BExpr, comment: Option[String] = None, attributes: List[(String, String)] = List.empty) extends BCmd { + override def toString: String = s"assume $attrString $body;" override def functionOps: Set[FunctionOp] = body.functionOps override def locals: Set[BVar] = body.locals override def globals: Set[BVar] = body.globals } case class BProcedureCall(name: String, lhss: Seq[BVar], params: Seq[BExpr], comment: Option[String] = None) extends BCmd { + + override def attributes: List[(String, String)] = List.empty override def toString: String = { if (lhss.isEmpty) { - s"call $name();" + s"call $attrString $name();" } else { - s"call ${lhss.mkString(", ")} := $name(${params.mkString(", ")});" + s"call $attrString ${lhss.mkString(", ")} := $name(${params.mkString(", ")});" } } override def functionOps: Set[FunctionOp] = params.flatMap(p => p.functionOps).toSet @@ -53,6 +65,7 @@ case class BProcedureCall(name: String, lhss: Seq[BVar], params: Seq[BExpr], com } case class AssignCmd(lhss: Seq[BVar], rhss: Seq[BExpr], comment: Option[String] = None) extends BCmd { + override def attributes: List[(String, String)] = List.empty override def toString: String = s"${lhss.mkString(", ")} := ${rhss.mkString(", ")};" override def functionOps: Set[FunctionOp] = rhss.flatMap(r => r.functionOps).toSet override def locals: Set[BVar] = lhss.flatMap(l => l.locals).toSet ++ rhss.flatMap(r => r.locals).toSet @@ -64,6 +77,7 @@ object AssignCmd { } case class MapAssignCmd(lhs: MapAccess, rhs: BExpr, comment: Option[String] = None) extends BCmd { + override def attributes: List[(String, String)] = List.empty override def toString: String = s"$lhs := $rhs;" override def functionOps: Set[FunctionOp] = lhs.functionOps ++ rhs.functionOps override def locals: Set[BVar] = lhs.locals ++ rhs.locals @@ -71,6 +85,7 @@ case class MapAssignCmd(lhs: MapAccess, rhs: BExpr, comment: Option[String] = No } case class Havoc(vars: Set[BVar], comment: Option[String] = None) extends BCmd { + override def attributes: List[(String, String)] = List.empty override def toString: String = { if (vars.isEmpty) { "havoc;" @@ -87,6 +102,7 @@ case class IfCmd(guard: BExpr, thenCmds: List[BCmd], comment: Option[String] = N val thenList = thenCmds.flatMap(x => x.toBoogie).map(s => " " + s) List(s"if ($guard) {") ++ thenList ++ List("}") } + override def attributes: List[(String, String)] = List.empty override def toString: String = toBoogie.mkString("\n") override def functionOps: Set[FunctionOp] = guard.functionOps ++ thenCmds.flatMap(c => c.functionOps).toSet override def locals: Set[BVar] = guard.locals ++ thenCmds.flatMap(c => c.locals).toSet @@ -94,15 +110,19 @@ case class IfCmd(guard: BExpr, thenCmds: List[BCmd], comment: Option[String] = N } case class GoToCmd(destination: String, comment: Option[String] = None) extends BCmd { + override def attributes: List[(String, String)] = List.empty override def toString: String = s"goto $destination;" } case object ReturnCmd extends BCmd { + override def attributes: List[(String, String)] = List.empty override def comment: Option[String] = None override def toString: String = "return;" } case class Comment(actualComment: String) extends BCmd { + + override def attributes: List[(String, String)] = List.empty override def comment: Option[String] = Some(actualComment) override def toBoogie: List[String] = List(s"//$actualComment") } diff --git a/src/main/scala/ir/Statement.scala b/src/main/scala/ir/Statement.scala index 907c4324a..8a8808b15 100644 --- a/src/main/scala/ir/Statement.scala +++ b/src/main/scala/ir/Statement.scala @@ -10,7 +10,7 @@ trait Statement extends Command { ) } -class LocalAssign(var lhs: Variable, var rhs: Expr) extends Statement { +case class LocalAssign(var lhs: Variable, var rhs: Expr, val address: Option[Int] = None) extends Statement { //override def locals: Set[Variable] = rhs.locals + lhs override def modifies: Set[Global] = lhs match { case r: Register => Set(r) @@ -20,7 +20,7 @@ class LocalAssign(var lhs: Variable, var rhs: Expr) extends Statement { override def acceptVisit(visitor: Visitor): Statement = visitor.visitLocalAssign(this) } -class MemoryAssign(var lhs: Memory, var rhs: MemoryStore) extends Statement { +case class MemoryAssign(var lhs: Memory, var rhs: MemoryStore, val address: Option[Int] = None) extends Statement { override def modifies: Set[Global] = Set(lhs) //override def locals: Set[Variable] = rhs.locals override def toString: String = s"$lhs := $rhs" @@ -32,7 +32,12 @@ case object NOP extends Statement { override def acceptVisit(visitor: Visitor): Statement = this } -class Assert(var body: Expr, var comment: Option[String]) extends Statement { +case class Assume(var body: Expr, var comment: Option[String]) extends Statement { + override def toString: String = s"assume $body" + comment.map(" //" + _) + override def acceptVisit(visitor: Visitor): Statement = visitor.visitAssume(this) +} + +case class Assert(var body: Expr, var comment: Option[String]) extends Statement { override def toString: String = s"assert $body" + comment.map(" //" + _) override def acceptVisit(visitor: Visitor): Statement = visitor.visitAssert(this) } @@ -44,7 +49,7 @@ trait Jump extends Command { def acceptVisit(visitor: Visitor): Jump = throw new Exception("visitor " + visitor + " unimplemented for: " + this) } -class GoTo(var target: Block, var condition: Option[Expr]) extends Jump { +case class GoTo(var target: Block, var condition: Option[Expr]) extends Jump { /* override def locals: Set[Variable] = condition match { case Some(c) => c.locals case None => Set() @@ -54,7 +59,7 @@ class GoTo(var target: Block, var condition: Option[Expr]) extends Jump { override def acceptVisit(visitor: Visitor): Jump = visitor.visitGoTo(this) } -class DirectCall(var target: Procedure, var condition: Option[Expr], var returnTarget: Option[Block]) extends Jump { +case class DirectCall(var target: Procedure, var condition: Option[Expr], var returnTarget: Option[Block], val address: Option[Int] = None) extends Jump { /* override def locals: Set[Variable] = condition match { case Some(c) => c.locals case None => Set() @@ -64,7 +69,8 @@ class DirectCall(var target: Procedure, var condition: Option[Expr], var returnT override def acceptVisit(visitor: Visitor): Jump = visitor.visitDirectCall(this) } -class IndirectCall(var target: Variable, var condition: Option[Expr], var returnTarget: Option[Block]) extends Jump { +case class IndirectCall(var target: Variable, var condition: Option[Expr], var returnTarget: Option[Block], + val address: Option[Int] = None) extends Jump { /* override def locals: Set[Variable] = condition match { case Some(c) => c.locals + target case None => Set(target) diff --git a/src/main/scala/ir/Visitor.scala b/src/main/scala/ir/Visitor.scala index 6fd3a2339..fa88da27f 100644 --- a/src/main/scala/ir/Visitor.scala +++ b/src/main/scala/ir/Visitor.scala @@ -21,6 +21,11 @@ abstract class Visitor { node } + def visitAssume(node: Assume): Statement = { + node.body = visitExpr(node.body) + node + } + def visitAssert(node: Assert): Statement = { node.body = visitExpr(node.body) node @@ -197,6 +202,11 @@ abstract class ReadOnlyVisitor extends Visitor { node } + override def visitAssume(node: Assume): Statement = { + visitExpr(node.body) + node + } + override def visitAssert(node: Assert): Statement = { visitExpr(node.body) node diff --git a/src/main/scala/translating/BAPLoader.scala b/src/main/scala/translating/BAPLoader.scala index bf5b96ac2..979fdafb8 100644 --- a/src/main/scala/translating/BAPLoader.scala +++ b/src/main/scala/translating/BAPLoader.scala @@ -231,13 +231,15 @@ object BAPLoader { def visitImmDef(ctx: ImmDefContext): BAPLocalAssign = { val line = visitQuoteString(ctx.tid.name) val insn = parseFromAttrs(ctx.attrs, "insn").getOrElse("") - BAPLocalAssign(visitImmVar(ctx.lhs), visitExp(ctx.rhs), line, insn) + val addr = parseFromAttrs(ctx.attrs, "address").map(x => Integer.parseInt(x.stripPrefix("0x"), 16)); + BAPLocalAssign(visitImmVar(ctx.lhs), visitExp(ctx.rhs), line, insn, addr) } def visitMemDef(ctx: MemDefContext): BAPMemAssign = { val line = visitQuoteString(ctx.tid.name) val insn = parseFromAttrs(ctx.attrs, "insn").getOrElse("") - BAPMemAssign(visitMemVar(ctx.lhs), visitStore(ctx.rhs), line, insn) + val addr = parseFromAttrs(ctx.attrs, "address").map(x => Integer.parseInt(x.stripPrefix("0x"), 16)); + BAPMemAssign(visitMemVar(ctx.lhs), visitStore(ctx.rhs), line, insn, addr) } def visitQuoteString(ctx: QuoteStringContext): String = ctx.getText.stripPrefix("\"").stripSuffix("\"") diff --git a/src/main/scala/translating/BAPToIR.scala b/src/main/scala/translating/BAPToIR.scala index 943e1b600..62c9e5ab4 100644 --- a/src/main/scala/translating/BAPToIR.scala +++ b/src/main/scala/translating/BAPToIR.scala @@ -60,8 +60,8 @@ class BAPToIR(var program: BAPProgram, mainAddress: Int) { } private def translate(s: BAPStatement) = s match { - case b: BAPMemAssign => MemoryAssign(b.lhs.toIR, b.rhs.toIR) - case b: BAPLocalAssign => LocalAssign(b.lhs.toIR, b.rhs.toIR) + case b: BAPMemAssign => MemoryAssign(b.lhs.toIR, b.rhs.toIR, b.address) + case b: BAPLocalAssign => LocalAssign(b.lhs.toIR, b.rhs.toIR, b.address) case _ => throw new Exception("unsupported statement: " + s) } diff --git a/src/main/scala/translating/IRToBoogie.scala b/src/main/scala/translating/IRToBoogie.scala index 161586a2a..3e3193833 100644 --- a/src/main/scala/translating/IRToBoogie.scala +++ b/src/main/scala/translating/IRToBoogie.scala @@ -312,8 +312,17 @@ class IRToBoogie(var program: Program, var spec: Specification) { sections.toList } + + def getCaptureStateStatement(stateName: String): BAssume = { + BAssume(TrueBLiteral, None, List((":captureState", s"\"$stateName\""))) + } + def translateBlock(b: Block): BBlock = { - val cmds = b.statements.flatMap(s => translate(s)) ++ b.jumps.flatMap(j => translate(j)) + val cmds = (b.address match { + case Some(addr) => List(getCaptureStateStatement(s"addr:0x${addr.toHexString}")) + case _ => List.empty + }) ++ (b.statements.flatMap(s => translate(s)) ++ b.jumps.flatMap(j => translate(j))) + BBlock(b.label, cmds.toList) } @@ -369,8 +378,13 @@ class IRToBoogie(var program: Program, var spec: Specification) { val lhsGamma = m.lhs.toGamma val rhsGamma = m.rhs.toGamma val store = AssignCmd(List(lhs, lhsGamma), List(rhs, rhsGamma)) + val stateSplit = s match { + case MemoryAssign (_,_, Some(addr)) => List(getCaptureStateStatement(s"addr:0x${addr.toHexString}")) + case LocalAssign(_,_, Some(addr)) => List(getCaptureStateStatement(s"addr:0x${addr.toHexString}")) + case _ => List.empty + } if (lhs == stack) { - List(store) + List(store) ++ stateSplit } else { val rely = BProcedureCall("rely", List(), List()) val gammaValueCheck = BAssert(BinaryBExpr(BoolIMPLIES, L(lhs, rhs.index), m.rhs.value.toGamma)) @@ -393,7 +407,7 @@ class IRToBoogie(var program: Program, var spec: Specification) { BAssert(BinaryBExpr(BoolIMPLIES, addrCheck, checksAnd)) } val guaranteeChecks = guarantees.map(v => BAssert(v)) - (List(rely, gammaValueCheck) ++ oldAssigns ++ oldGammaAssigns :+ store) ++ secureUpdate ++ guaranteeChecks + (List(rely, gammaValueCheck) ++ oldAssigns ++ oldGammaAssigns :+ store) ++ secureUpdate ++ guaranteeChecks ++ stateSplit } case l: LocalAssign => val lhs = l.lhs.toBoogie From b3d026095ed9ac992f95a86a56e2db34d852b482 Mon Sep 17 00:00:00 2001 From: Alistair Michael Date: Fri, 27 Oct 2023 17:28:56 +1000 Subject: [PATCH 03/11] cleanup --- src/main/scala/boogie/BCmd.scala | 8 ++++---- src/main/scala/boogie/BProgram.scala | 28 +++++++++++++++------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/main/scala/boogie/BCmd.scala b/src/main/scala/boogie/BCmd.scala index b2e3dad56..0415bb875 100644 --- a/src/main/scala/boogie/BCmd.scala +++ b/src/main/scala/boogie/BCmd.scala @@ -36,14 +36,14 @@ sealed trait BCmd() extends BCmdOrBlock { } case class BAssert(body: BExpr, comment: Option[String] = None, attributes: List[(String, String)] = List.empty) extends BCmd { - override def toString: String = s"assert $attrString $body;" + override def toString: String = s"assert $attrString$body;" override def functionOps: Set[FunctionOp] = body.functionOps override def locals: Set[BVar] = body.locals override def globals: Set[BVar] = body.globals } case class BAssume(body: BExpr, comment: Option[String] = None, attributes: List[(String, String)] = List.empty) extends BCmd { - override def toString: String = s"assume $attrString $body;" + override def toString: String = s"assume $attrString$body;" override def functionOps: Set[FunctionOp] = body.functionOps override def locals: Set[BVar] = body.locals override def globals: Set[BVar] = body.globals @@ -54,9 +54,9 @@ case class BProcedureCall(name: String, lhss: Seq[BVar], params: Seq[BExpr], com override def attributes: List[(String, String)] = List.empty override def toString: String = { if (lhss.isEmpty) { - s"call $attrString $name();" + s"call $attrString$name();" } else { - s"call $attrString ${lhss.mkString(", ")} := $name(${params.mkString(", ")});" + s"call $attrString${lhss.mkString(", ")} := $name(${params.mkString(", ")});" } } override def functionOps: Set[FunctionOp] = params.flatMap(p => p.functionOps).toSet diff --git a/src/main/scala/boogie/BProgram.scala b/src/main/scala/boogie/BProgram.scala index 278381536..fd21fbe11 100644 --- a/src/main/scala/boogie/BProgram.scala +++ b/src/main/scala/boogie/BProgram.scala @@ -4,11 +4,12 @@ case class BProgram(declarations: List[BDeclaration]) { override def toString: String = declarations.flatMap(x => x.toBoogie).mkString("\n") } -trait BDeclaration(val _attributes: List[(String, String)]) { +trait BDeclaration() { + def attributes: List[(String, String)] def toBoogie: List[String] = List(toString) - val attrString: String = if (_attributes.nonEmpty) then { - _attributes.map(a => s"{${a._1} ${a._2}}").mkString(" ") + val attrString: String = if (attributes.nonEmpty) then { + attributes.map(a => s"{${a._1} ${a._2}}").mkString(" ") } else { "" } @@ -27,11 +28,11 @@ case class BProcedure( modifies: Set[BVar], body: List[BCmdOrBlock], attributes: List[(String, String)] -) extends BDeclaration(attributes) +) extends BDeclaration() with Ordered[BProcedure] { override def compare(that: BProcedure): Int = name.compare(that.name) override def toBoogie: List[String] = { - val header = s"procedure $attrString $name(${in.map(_.withType).mkString(", ")})" + val header = s"procedure $attrString$name(${in.map(_.withType).mkString(", ")})" val returns = if (out.nonEmpty) { s" returns (${out.map(_.withType).mkString(", ")})" } else { @@ -67,19 +68,19 @@ case class BProcedure( def globals: Set[BVar] = body.flatMap(c => c.globals).toSet ++ modifies } -case class BAxiom(body: BExpr, attributes: List[(String, String)]) extends BDeclaration(attributes) { - override def toString: String = s"axiom $attrString $body;" +case class BAxiom(body: BExpr, attributes: List[(String, String)]) extends BDeclaration() { + override def toString: String = s"axiom $attrString$body;" } case class BFunction(name: String, in: List[BVar], out: BVar, body: Option[BExpr], attributes: List[(String, String)]) - extends BDeclaration(attributes) + extends BDeclaration() with Ordered[BFunction] { override def compare(that: BFunction): Int = name.compare(that.name) override def toBoogie: List[String] = { val inString = in.map(_.withType).mkString(", ") - val declString = s"function $attrString $name($inString) returns (${out.withType})" + val declString = s"function $attrString$name($inString) returns (${out.withType})" body match { case Some(b) => List(declString + " {", " " + b.toString, "}", "") case None => List(declString + ";") @@ -92,16 +93,17 @@ case class BFunction(name: String, in: List[BVar], out: BVar, body: Option[BExpr } } -case class BVarDecl(variable: BVar, attributes: List[(String, String)]) extends BDeclaration(attributes) with Ordered[BVarDecl] { +case class BVarDecl(variable: BVar, attributes: List[(String, String)]) extends BDeclaration() with Ordered[BVarDecl] { def compare(that: BVarDecl): Int = variable.compare(that.variable) override def toString: String = if (variable.scope == Scope.Const) { - s"const $attrString $variable: ${variable.getType};" + s"const $attrString$variable: ${variable.getType};" } else { - s"var $attrString $variable: ${variable.getType};" + s"var $attrString$variable: ${variable.getType};" } } -case class BConstAxiomPair(const: BVarDecl, axiom: BAxiom) extends BDeclaration(List.empty) with Ordered[BConstAxiomPair] { +case class BConstAxiomPair(const: BVarDecl, axiom: BAxiom) extends BDeclaration() with Ordered[BConstAxiomPair] { + override def attributes: List[(String, String)] = List.empty override def compare(that: BConstAxiomPair): Int = const.compare(that.const) override def toString: String = const.toString + "\n" + axiom.toString } From a60c3542522e813d19f989c60377a61a80d3e943 Mon Sep 17 00:00:00 2001 From: Alistair Michael Date: Fri, 27 Oct 2023 17:33:40 +1000 Subject: [PATCH 04/11] update expected --- .../clang/arrays_simple.expected | 52 ++-- .../clang_O2/arrays_simple.expected | 25 +- .../arrays_simple.expected | 52 ++-- .../clang_pic/arrays_simple.expected | 52 ++-- .../gcc_O2/arrays_simple.expected | 25 +- .../clang/basic_arrays_read.expected | 53 ++-- .../clang_O2/basic_arrays_read.expected | 40 +-- .../basic_arrays_read.expected | 53 ++-- .../clang_pic/basic_arrays_read.expected | 57 ++-- .../gcc/basic_arrays_read.expected | 40 +-- .../gcc_O2/basic_arrays_read.expected | 40 +-- .../basic_arrays_read.expected | 40 +-- .../gcc_pic/basic_arrays_read.expected | 44 +-- .../clang/basic_arrays_write.expected | 59 ++-- .../clang_O2/basic_arrays_write.expected | 48 ++-- .../basic_arrays_write.expected | 59 ++-- .../clang_pic/basic_arrays_write.expected | 63 +++-- .../gcc/basic_arrays_write.expected | 55 ++-- .../gcc_O2/basic_arrays_write.expected | 48 ++-- .../basic_arrays_write.expected | 55 ++-- .../gcc_pic/basic_arrays_write.expected | 59 ++-- .../clang/basic_assign_assign.expected | 46 ++-- .../clang_O2/basic_assign_assign.expected | 46 ++-- .../basic_assign_assign.expected | 46 ++-- .../clang_pic/basic_assign_assign.expected | 50 ++-- .../gcc/basic_assign_assign.expected | 42 +-- .../gcc_O2/basic_assign_assign.expected | 46 ++-- .../basic_assign_assign.expected | 42 +-- .../gcc_pic/basic_assign_assign.expected | 46 ++-- .../clang/basic_assign_increment.expected | 52 ++-- .../clang_O2/basic_assign_increment.expected | 52 ++-- .../basic_assign_increment.expected | 52 ++-- .../clang_pic/basic_assign_increment.expected | 56 ++-- .../gcc/basic_assign_increment.expected | 48 ++-- .../gcc_O2/basic_assign_increment.expected | 52 ++-- .../basic_assign_increment.expected | 48 ++-- .../gcc_pic/basic_assign_increment.expected | 52 ++-- .../clang/basic_function_call_caller.expected | 96 ++++--- .../basic_function_call_caller.expected | 61 +++-- .../basic_function_call_caller.expected | 96 ++++--- .../basic_function_call_caller.expected | 96 ++++--- .../gcc/basic_function_call_caller.expected | 88 +++--- .../basic_function_call_caller.expected | 61 +++-- .../basic_function_call_caller.expected | 88 +++--- .../basic_function_call_caller.expected | 88 +++--- .../clang/basic_function_call_reader.expected | 99 ++++--- .../basic_function_call_reader.expected | 83 +++--- .../basic_function_call_reader.expected | 99 ++++--- .../basic_function_call_reader.expected | 103 +++---- .../gcc/basic_function_call_reader.expected | 91 ++++--- .../basic_function_call_reader.expected | 47 ++-- .../basic_function_call_reader.expected | 91 ++++--- .../basic_function_call_reader.expected | 95 ++++--- .../clang/basic_lock_read.expected | 100 +++---- .../clang_O2/basic_lock_read.expected | 54 ++-- .../basic_lock_read.expected | 100 +++---- .../clang_pic/basic_lock_read.expected | 104 +++---- .../gcc/basic_lock_read.expected | 94 ++++--- .../gcc_O2/basic_lock_read.expected | 56 ++-- .../basic_lock_read.expected | 94 ++++--- .../gcc_pic/basic_lock_read.expected | 98 +++---- .../clang/basic_lock_security_read.expected | 97 ++++--- .../basic_lock_security_read.expected | 83 +++--- .../basic_lock_security_read.expected | 97 ++++--- .../basic_lock_security_read.expected | 101 +++---- .../gcc/basic_lock_security_read.expected | 91 ++++--- .../gcc_O2/basic_lock_security_read.expected | 53 ++-- .../basic_lock_security_read.expected | 91 ++++--- .../gcc_pic/basic_lock_security_read.expected | 95 ++++--- .../clang/basic_lock_security_write.expected | 74 ++--- .../basic_lock_security_write.expected | 57 ++-- .../basic_lock_security_write.expected | 74 ++--- .../basic_lock_security_write.expected | 78 +++--- .../gcc/basic_lock_security_write.expected | 66 +++-- .../gcc_O2/basic_lock_security_write.expected | 57 ++-- .../basic_lock_security_write.expected | 66 +++-- .../basic_lock_security_write.expected | 70 ++--- .../clang/basic_lock_unlock.expected | 53 ++-- .../clang_O2/basic_lock_unlock.expected | 57 ++-- .../basic_lock_unlock.expected | 53 ++-- .../clang_pic/basic_lock_unlock.expected | 57 ++-- .../gcc/basic_lock_unlock.expected | 49 ++-- .../gcc_O2/basic_lock_unlock.expected | 57 ++-- .../basic_lock_unlock.expected | 49 ++-- .../gcc_pic/basic_lock_unlock.expected | 53 ++-- .../clang/basic_loop_assign.expected | 50 ++-- .../clang_O2/basic_loop_assign.expected | 50 ++-- .../basic_loop_assign.expected | 50 ++-- .../clang_pic/basic_loop_assign.expected | 54 ++-- .../gcc/basic_loop_assign.expected | 46 ++-- .../gcc_O2/basic_loop_assign.expected | 50 ++-- .../basic_loop_assign.expected | 46 ++-- .../gcc_pic/basic_loop_assign.expected | 50 ++-- .../clang/basic_operation_evaluation.expected | 123 +++++---- .../basic_operation_evaluation.expected | 25 +- .../basic_operation_evaluation.expected | 123 +++++---- .../basic_operation_evaluation.expected | 123 +++++---- .../gcc/basic_operation_evaluation.expected | 82 +++--- .../basic_operation_evaluation.expected | 25 +- .../basic_operation_evaluation.expected | 82 +++--- .../basic_operation_evaluation.expected | 82 +++--- .../clang/basic_sec_policy_read.expected | 97 ++++--- .../clang_O2/basic_sec_policy_read.expected | 83 +++--- .../basic_sec_policy_read.expected | 97 ++++--- .../clang_pic/basic_sec_policy_read.expected | 101 +++---- .../gcc/basic_sec_policy_read.expected | 91 ++++--- .../gcc_O2/basic_sec_policy_read.expected | 53 ++-- .../basic_sec_policy_read.expected | 91 ++++--- .../gcc_pic/basic_sec_policy_read.expected | 95 ++++--- .../clang/basic_sec_policy_write.expected | 72 ++--- .../clang_O2/basic_sec_policy_write.expected | 59 ++-- .../basic_sec_policy_write.expected | 72 ++--- .../clang_pic/basic_sec_policy_write.expected | 76 +++--- .../gcc/basic_sec_policy_write.expected | 64 +++-- .../gcc_O2/basic_sec_policy_write.expected | 59 ++-- .../basic_sec_policy_write.expected | 64 +++-- .../gcc_pic/basic_sec_policy_write.expected | 68 ++--- .../clang/basicassign_gamma0.expected | 52 ++-- .../clang_O2/basicassign_gamma0.expected | 52 ++-- .../basicassign_gamma0.expected | 52 ++-- .../clang_pic/basicassign_gamma0.expected | 56 ++-- .../gcc/basicassign_gamma0.expected | 48 ++-- .../gcc_O2/basicassign_gamma0.expected | 52 ++-- .../basicassign_gamma0.expected | 48 ++-- .../gcc_pic/basicassign_gamma0.expected | 52 ++-- .../basicfree/clang/basicfree.expected | 91 ++++--- .../basicfree/clang_O2/basicfree.expected | 21 +- .../clang_no_plt_no_pic/basicfree.expected | 91 ++++--- .../basicfree/clang_pic/basicfree.expected | 91 ++++--- .../correct/basicfree/gcc/basicfree.expected | 83 +++--- .../basicfree/gcc_O2/basicfree.expected | 21 +- .../gcc_no_plt_no_pic/basicfree.expected | 83 +++--- .../basicfree/gcc_pic/basicfree.expected | 83 +++--- src/test/correct/cjump/clang/cjump.expected | 103 +++---- .../correct/cjump/clang_O2/cjump.expected | 57 ++-- .../cjump/clang_no_plt_no_pic/cjump.expected | 103 +++---- .../correct/cjump/clang_pic/cjump.expected | 107 ++++---- src/test/correct/cjump/gcc/cjump.expected | 89 +++--- src/test/correct/cjump/gcc_O2/cjump.expected | 53 ++-- .../cjump/gcc_no_plt_no_pic/cjump.expected | 89 +++--- src/test/correct/cjump/gcc_pic/cjump.expected | 93 ++++--- .../correct/function/clang/function.expected | 83 +++--- .../function/clang_O2/function.expected | 57 ++-- .../clang_no_plt_no_pic/function.expected | 83 +++--- .../function/clang_pic/function.expected | 83 +++--- .../correct/function/gcc/function.expected | 81 +++--- .../correct/function/gcc_O2/function.expected | 53 ++-- .../gcc_no_plt_no_pic/function.expected | 81 +++--- .../function/gcc_pic/function.expected | 81 +++--- .../function1/clang/function1.expected | 125 +++++---- .../function1/clang_O2/function1.expected | 106 ++++---- .../clang_no_plt_no_pic/function1.expected | 125 +++++---- .../function1/clang_pic/function1.expected | 125 +++++---- .../correct/function1/gcc/function1.expected | 115 ++++---- .../function1/gcc_O2/function1.expected | 98 +++---- .../gcc_no_plt_no_pic/function1.expected | 115 ++++---- .../function1/gcc_pic/function1.expected | 115 ++++---- .../clang/functions_with_params.expected | 85 +++--- .../clang_O2/functions_with_params.expected | 25 +- .../functions_with_params.expected | 85 +++--- .../clang_pic/functions_with_params.expected | 85 +++--- .../gcc/functions_with_params.expected | 77 +++--- .../gcc_O2/functions_with_params.expected | 25 +- .../functions_with_params.expected | 77 +++--- .../gcc_pic/functions_with_params.expected | 77 +++--- .../ifbranches/clang/ifbranches.expected | 100 ++++--- .../ifbranches/clang_O2/ifbranches.expected | 63 ++--- .../clang_no_plt_no_pic/ifbranches.expected | 100 ++++--- .../ifbranches/clang_pic/ifbranches.expected | 100 ++++--- .../ifbranches/gcc/ifbranches.expected | 94 ++++--- .../ifbranches/gcc_O2/ifbranches.expected | 59 ++-- .../gcc_no_plt_no_pic/ifbranches.expected | 94 ++++--- .../ifbranches/gcc_pic/ifbranches.expected | 94 ++++--- .../correct/ifglobal/clang/ifglobal.expected | 96 ++++--- .../ifglobal/clang_O2/ifglobal.expected | 52 ++-- .../clang_no_plt_no_pic/ifglobal.expected | 96 ++++--- .../ifglobal/clang_pic/ifglobal.expected | 100 +++---- .../correct/ifglobal/gcc/ifglobal.expected | 82 +++--- .../correct/ifglobal/gcc_O2/ifglobal.expected | 50 ++-- .../gcc_no_plt_no_pic/ifglobal.expected | 82 +++--- .../ifglobal/gcc_pic/ifglobal.expected | 86 +++--- .../clang_O2/indirect_call.expected | 69 ++--- .../gcc_O2/indirect_call.expected | 72 ++--- .../clang/initialisation.expected | 121 +++++---- .../clang_O2/initialisation.expected | 105 +++---- .../initialisation.expected | 121 +++++---- .../clang_pic/initialisation.expected | 117 ++++---- .../gcc/initialisation.expected | 77 +++--- .../gcc_O2/initialisation.expected | 97 +++---- .../gcc_no_plt_no_pic/initialisation.expected | 77 +++--- .../gcc_pic/initialisation.expected | 77 +++--- .../jumptable/clang_O2/jumptable.expected | 54 ++-- .../jumptable/gcc_O2/jumptable.expected | 94 ++++--- .../jumptable3/gcc/jumptable3.expected | 256 +++++++++++------- .../jumptable3/gcc_O2/jumptable3.expected | 152 +++++++---- .../gcc_no_plt_no_pic/jumptable3.expected | 256 +++++++++++------- .../jumptable3/gcc_pic/jumptable3.expected | 256 +++++++++++------- .../clang/malloc_with_local.expected | 121 +++++---- .../clang_O2/malloc_with_local.expected | 74 ++--- .../malloc_with_local.expected | 121 +++++---- .../clang_pic/malloc_with_local.expected | 121 +++++---- .../gcc/malloc_with_local.expected | 107 ++++---- .../gcc_O2/malloc_with_local.expected | 78 +++--- .../malloc_with_local.expected | 107 ++++---- .../gcc_pic/malloc_with_local.expected | 107 ++++---- .../clang/malloc_with_local2.expected | 126 +++++---- .../clang_O2/malloc_with_local2.expected | 74 ++--- .../malloc_with_local2.expected | 126 +++++---- .../clang_pic/malloc_with_local2.expected | 126 +++++---- .../gcc/malloc_with_local2.expected | 111 ++++---- .../gcc_O2/malloc_with_local2.expected | 78 +++--- .../malloc_with_local2.expected | 111 ++++---- .../gcc_pic/malloc_with_local2.expected | 111 ++++---- .../clang/malloc_with_local3.expected | 144 ++++++---- .../clang_O2/malloc_with_local3.expected | 74 ++--- .../malloc_with_local3.expected | 144 ++++++---- .../clang_pic/malloc_with_local3.expected | 144 ++++++---- .../gcc/malloc_with_local3.expected | 125 +++++---- .../gcc_O2/malloc_with_local3.expected | 112 ++++---- .../malloc_with_local3.expected | 125 +++++---- .../gcc_pic/malloc_with_local3.expected | 125 +++++---- .../multi_malloc/clang/multi_malloc.expected | 119 ++++---- .../clang_O2/multi_malloc.expected | 73 ++--- .../clang_no_plt_no_pic/multi_malloc.expected | 119 ++++---- .../clang_pic/multi_malloc.expected | 119 ++++---- .../multi_malloc/gcc/multi_malloc.expected | 105 +++---- .../multi_malloc/gcc_O2/multi_malloc.expected | 77 +++--- .../gcc_no_plt_no_pic/multi_malloc.expected | 105 +++---- .../gcc_pic/multi_malloc.expected | 105 +++---- .../correct/nestedif/clang/nestedif.expected | 110 ++++---- .../nestedif/clang_O2/nestedif.expected | 25 +- .../clang_no_plt_no_pic/nestedif.expected | 110 ++++---- .../nestedif/clang_pic/nestedif.expected | 110 ++++---- .../correct/nestedif/gcc/nestedif.expected | 100 ++++--- .../correct/nestedif/gcc_O2/nestedif.expected | 25 +- .../gcc_no_plt_no_pic/nestedif.expected | 100 ++++--- .../nestedif/gcc_pic/nestedif.expected | 100 ++++--- .../clang/no_interference_update_x.expected | 50 ++-- .../no_interference_update_x.expected | 50 ++-- .../no_interference_update_x.expected | 50 ++-- .../no_interference_update_x.expected | 54 ++-- .../gcc/no_interference_update_x.expected | 46 ++-- .../gcc_O2/no_interference_update_x.expected | 50 ++-- .../no_interference_update_x.expected | 46 ++-- .../gcc_pic/no_interference_update_x.expected | 50 ++-- .../clang/no_interference_update_y.expected | 50 ++-- .../no_interference_update_y.expected | 50 ++-- .../no_interference_update_y.expected | 50 ++-- .../no_interference_update_y.expected | 54 ++-- .../gcc/no_interference_update_y.expected | 46 ++-- .../gcc_O2/no_interference_update_y.expected | 50 ++-- .../no_interference_update_y.expected | 46 ++-- .../gcc_pic/no_interference_update_y.expected | 50 ++-- .../secret_write/clang/secret_write.expected | 74 ++--- .../clang_O2/secret_write.expected | 67 ++--- .../clang_no_plt_no_pic/secret_write.expected | 74 ++--- .../clang_pic/secret_write.expected | 78 +++--- .../secret_write/gcc/secret_write.expected | 66 +++-- .../secret_write/gcc_O2/secret_write.expected | 67 ++--- .../gcc_no_plt_no_pic/secret_write.expected | 66 +++-- .../gcc_pic/secret_write.expected | 70 ++--- .../simple_jump/clang/simple_jump.expected | 91 ++++--- .../simple_jump/clang_O2/simple_jump.expected | 25 +- .../clang_no_plt_no_pic/simple_jump.expected | 91 ++++--- .../clang_pic/simple_jump.expected | 91 ++++--- .../simple_jump/gcc/simple_jump.expected | 85 +++--- .../simple_jump/gcc_O2/simple_jump.expected | 25 +- .../gcc_no_plt_no_pic/simple_jump.expected | 85 +++--- .../simple_jump/gcc_pic/simple_jump.expected | 85 +++--- src/test/correct/switch/clang/switch.expected | 98 ++++--- .../correct/switch/clang_O2/switch.expected | 21 +- .../clang_no_plt_no_pic/switch.expected | 98 ++++--- .../correct/switch/clang_pic/switch.expected | 98 ++++--- src/test/correct/switch/gcc/switch.expected | 95 ++++--- .../correct/switch/gcc_O2/switch.expected | 21 +- .../switch/gcc_no_plt_no_pic/switch.expected | 95 ++++--- .../correct/switch/gcc_pic/switch.expected | 95 ++++--- .../correct/switch2/clang_O2/switch2.expected | 19 +- src/test/correct/switch2/gcc/switch2.expected | 161 ++++++----- .../correct/switch2/gcc_O2/switch2.expected | 19 +- .../gcc_no_plt_no_pic/switch2.expected | 161 ++++++----- .../correct/switch2/gcc_pic/switch2.expected | 161 ++++++----- .../correct/syscall/clang/syscall.expected | 90 +++--- .../clang_no_plt_no_pic/syscall.expected | 90 +++--- .../syscall/clang_pic/syscall.expected | 90 +++--- src/test/correct/syscall/gcc/syscall.expected | 85 +++--- .../correct/syscall/gcc_O2/syscall.expected | 28 +- .../gcc_no_plt_no_pic/syscall.expected | 85 +++--- .../correct/syscall/gcc_pic/syscall.expected | 85 +++--- .../clang/using_gamma_conditional.expected | 98 ++++--- .../clang_O2/using_gamma_conditional.expected | 79 +++--- .../using_gamma_conditional.expected | 98 ++++--- .../using_gamma_conditional.expected | 102 +++---- .../gcc/using_gamma_conditional.expected | 78 +++--- .../gcc_O2/using_gamma_conditional.expected | 75 ++--- .../using_gamma_conditional.expected | 78 +++--- .../gcc_pic/using_gamma_conditional.expected | 82 +++--- .../clang/using_gamma_write_z.expected | 52 ++-- .../clang_O2/using_gamma_write_z.expected | 52 ++-- .../using_gamma_write_z.expected | 52 ++-- .../clang_pic/using_gamma_write_z.expected | 56 ++-- .../gcc/using_gamma_write_z.expected | 48 ++-- .../gcc_O2/using_gamma_write_z.expected | 52 ++-- .../using_gamma_write_z.expected | 48 ++-- .../gcc_pic/using_gamma_write_z.expected | 52 ++-- .../basicassign/clang/basicassign.expected | 68 ++--- .../basicassign/clang_O2/basicassign.expected | 61 +++-- .../clang_no_plt_no_pic/basicassign.expected | 68 ++--- .../clang_pic/basicassign.expected | 72 ++--- .../basicassign/gcc/basicassign.expected | 56 ++-- .../basicassign/gcc_O2/basicassign.expected | 61 +++-- .../gcc_no_plt_no_pic/basicassign.expected | 56 ++-- .../basicassign/gcc_pic/basicassign.expected | 60 ++-- .../basicassign1/clang/basicassign1.expected | 64 +++-- .../clang_O2/basicassign1.expected | 48 ++-- .../clang_no_plt_no_pic/basicassign1.expected | 64 +++-- .../clang_pic/basicassign1.expected | 68 ++--- .../basicassign1/gcc/basicassign1.expected | 56 ++-- .../basicassign1/gcc_O2/basicassign1.expected | 48 ++-- .../gcc_no_plt_no_pic/basicassign1.expected | 56 ++-- .../gcc_pic/basicassign1.expected | 60 ++-- .../basicassign2/clang/basicassign2.expected | 66 +++-- .../clang_O2/basicassign2.expected | 50 ++-- .../clang_no_plt_no_pic/basicassign2.expected | 66 +++-- .../clang_pic/basicassign2.expected | 66 +++-- .../basicassign2/gcc/basicassign2.expected | 58 ++-- .../basicassign2/gcc_O2/basicassign2.expected | 50 ++-- .../gcc_no_plt_no_pic/basicassign2.expected | 58 ++-- .../gcc_pic/basicassign2.expected | 58 ++-- .../basicassign3/clang/basicassign3.expected | 66 +++-- .../clang_O2/basicassign3.expected | 50 ++-- .../clang_no_plt_no_pic/basicassign3.expected | 66 +++-- .../clang_pic/basicassign3.expected | 70 ++--- .../basicassign3/gcc/basicassign3.expected | 58 ++-- .../basicassign3/gcc_O2/basicassign3.expected | 50 ++-- .../gcc_no_plt_no_pic/basicassign3.expected | 58 ++-- .../gcc_pic/basicassign3.expected | 62 +++-- .../incorrect/iflocal/clang/iflocal.expected | 88 +++--- .../clang_no_plt_no_pic/iflocal.expected | 88 +++--- .../iflocal/clang_pic/iflocal.expected | 88 +++--- .../incorrect/iflocal/gcc/iflocal.expected | 82 +++--- .../gcc_no_plt_no_pic/iflocal.expected | 82 +++--- .../iflocal/gcc_pic/iflocal.expected | 82 +++--- .../clang/nestedifglobal.expected | 111 ++++---- .../nestedifglobal.expected | 111 ++++---- .../clang_pic/nestedifglobal.expected | 120 ++++---- .../gcc/nestedifglobal.expected | 103 ++++--- .../gcc_no_plt_no_pic/nestedifglobal.expected | 103 ++++--- .../gcc_pic/nestedifglobal.expected | 107 ++++---- 349 files changed, 14711 insertions(+), 12234 deletions(-) diff --git a/src/test/correct/arrays_simple/clang/arrays_simple.expected b/src/test/correct/arrays_simple/clang/arrays_simple.expected index da968d58d..aece6f15e 100644 --- a/src/test/correct/arrays_simple/clang/arrays_simple.expected +++ b/src/test/correct/arrays_simple/clang/arrays_simple.expected @@ -1,38 +1,38 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1872bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1872bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,12 +82,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -181,13 +181,17 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R8); + assume {:captureState "addr:0x71c"}true; R8, Gamma_R8 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/arrays_simple/clang_O2/arrays_simple.expected b/src/test/correct/arrays_simple/clang_O2/arrays_simple.expected index 5f6aef7e1..863d7bd46 100644 --- a/src/test/correct/arrays_simple/clang_O2/arrays_simple.expected +++ b/src/test/correct/arrays_simple/clang_O2/arrays_simple.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1840bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1840bv64); +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -155,6 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/arrays_simple/clang_no_plt_no_pic/arrays_simple.expected b/src/test/correct/arrays_simple/clang_no_plt_no_pic/arrays_simple.expected index da968d58d..aece6f15e 100644 --- a/src/test/correct/arrays_simple/clang_no_plt_no_pic/arrays_simple.expected +++ b/src/test/correct/arrays_simple/clang_no_plt_no_pic/arrays_simple.expected @@ -1,38 +1,38 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1872bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1872bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,12 +82,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -181,13 +181,17 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R8); + assume {:captureState "addr:0x71c"}true; R8, Gamma_R8 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/arrays_simple/clang_pic/arrays_simple.expected b/src/test/correct/arrays_simple/clang_pic/arrays_simple.expected index da968d58d..aece6f15e 100644 --- a/src/test/correct/arrays_simple/clang_pic/arrays_simple.expected +++ b/src/test/correct/arrays_simple/clang_pic/arrays_simple.expected @@ -1,38 +1,38 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1872bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1872bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,12 +82,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -181,13 +181,17 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R8); + assume {:captureState "addr:0x71c"}true; R8, Gamma_R8 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/arrays_simple/gcc_O2/arrays_simple.expected b/src/test/correct/arrays_simple/gcc_O2/arrays_simple.expected index 2eddd390b..418f9a5da 100644 --- a/src/test/correct/arrays_simple/gcc_O2/arrays_simple.expected +++ b/src/test/correct/arrays_simple/gcc_O2/arrays_simple.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1896bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1896bv64); +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -155,6 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_arrays_read/clang/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/clang/basic_arrays_read.expected index 9347c6ceb..89944a5ec 100644 --- a/src/test/correct/basic_arrays_read/clang/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/clang/basic_arrays_read.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $arr_addr: bv64; -axiom {:extern } ($arr_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$arr_addr: bv64; +axiom {:extern }($arr_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -85,18 +85,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert true; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -190,13 +190,16 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> true); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), true); assert true; + assume {:captureState "addr:0x720"}true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; diff --git a/src/test/correct/basic_arrays_read/clang_O2/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/clang_O2/basic_arrays_read.expected index f1be1b70e..62beee9a8 100644 --- a/src/test/correct/basic_arrays_read/clang_O2/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/clang_O2/basic_arrays_read.expected @@ -1,33 +1,33 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $arr_addr: bv64; -axiom {:extern } ($arr_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$arr_addr: bv64; +axiom {:extern }($arr_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -68,7 +68,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -76,18 +76,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert true; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_mem, R0, R8, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -179,11 +179,13 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> true); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), true); assert true; + assume {:captureState "addr:0x71c"}true; return; } diff --git a/src/test/correct/basic_arrays_read/clang_no_plt_no_pic/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/clang_no_plt_no_pic/basic_arrays_read.expected index 9347c6ceb..89944a5ec 100644 --- a/src/test/correct/basic_arrays_read/clang_no_plt_no_pic/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/clang_no_plt_no_pic/basic_arrays_read.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $arr_addr: bv64; -axiom {:extern } ($arr_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$arr_addr: bv64; +axiom {:extern }($arr_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -85,18 +85,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert true; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -190,13 +190,16 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> true); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), true); assert true; + assume {:captureState "addr:0x720"}true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; diff --git a/src/test/correct/basic_arrays_read/clang_pic/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/clang_pic/basic_arrays_read.expected index d4caa02b2..e16692dc4 100644 --- a/src/test/correct/basic_arrays_read/clang_pic/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/clang_pic/basic_arrays_read.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $arr_addr: bv64; -axiom {:extern } ($arr_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$arr_addr: bv64; +axiom {:extern }($arr_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -93,7 +93,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -101,18 +101,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert true; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -222,8 +222,10 @@ procedure main() free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x758"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4056bv64)) || L(mem, bvadd64(R8, 4056bv64))); @@ -231,6 +233,7 @@ procedure main() assert (L(mem, R8) ==> true); mem, Gamma_mem := memory_store32_le(mem, R8, 0bv32), gamma_store32(Gamma_mem, R8, true); assert true; + assume {:captureState "addr:0x764"}true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; diff --git a/src/test/correct/basic_arrays_read/gcc/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/gcc/basic_arrays_read.expected index bc637e63a..cf4f9458e 100644 --- a/src/test/correct/basic_arrays_read/gcc/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/gcc/basic_arrays_read.expected @@ -1,36 +1,36 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $arr_addr: bv64; -axiom {:extern } ($arr_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$arr_addr: bv64; +axiom {:extern }($arr_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -71,7 +71,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -79,18 +79,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert true; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_mem, R0, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -182,12 +182,14 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); assert (L(mem, R0) ==> true); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert true; + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); diff --git a/src/test/correct/basic_arrays_read/gcc_O2/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/gcc_O2/basic_arrays_read.expected index 562f1d5eb..697310dfc 100644 --- a/src/test/correct/basic_arrays_read/gcc_O2/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/gcc_O2/basic_arrays_read.expected @@ -1,33 +1,33 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $arr_addr: bv64; -axiom {:extern } ($arr_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$arr_addr: bv64; +axiom {:extern }($arr_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -68,7 +68,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -76,18 +76,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert true; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -179,11 +179,13 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R1, 24bv64)) ==> true); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 24bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R1, 24bv64), true); assert true; + assume {:captureState "addr:0x608"}true; return; } diff --git a/src/test/correct/basic_arrays_read/gcc_no_plt_no_pic/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/gcc_no_plt_no_pic/basic_arrays_read.expected index bc637e63a..cf4f9458e 100644 --- a/src/test/correct/basic_arrays_read/gcc_no_plt_no_pic/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/gcc_no_plt_no_pic/basic_arrays_read.expected @@ -1,36 +1,36 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $arr_addr: bv64; -axiom {:extern } ($arr_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$arr_addr: bv64; +axiom {:extern }($arr_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -71,7 +71,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -79,18 +79,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert true; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_mem, R0, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -182,12 +182,14 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); assert (L(mem, R0) ==> true); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert true; + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); diff --git a/src/test/correct/basic_arrays_read/gcc_pic/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/gcc_pic/basic_arrays_read.expected index dfb325d26..583888bee 100644 --- a/src/test/correct/basic_arrays_read/gcc_pic/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/gcc_pic/basic_arrays_read.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $arr_addr: bv64; -axiom {:extern } ($arr_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$arr_addr: bv64; +axiom {:extern }($arr_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -95,18 +95,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert true; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_mem, R0, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -214,6 +214,7 @@ procedure main() free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4080bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4080bv64)) || L(mem, bvadd64(R0, 4080bv64))); @@ -221,6 +222,7 @@ procedure main() assert (L(mem, R0) ==> true); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert true; + assume {:captureState "addr:0x75c"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4080bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4080bv64)) || L(mem, bvadd64(R0, 4080bv64))); diff --git a/src/test/correct/basic_arrays_write/clang/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/clang/basic_arrays_write.expected index fae95e38d..f8f5ec6b5 100644 --- a/src/test/correct/basic_arrays_write/clang/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/clang/basic_arrays_write.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $arr_addr: bv64; -axiom {:extern } ($arr_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$arr_addr: bv64; +axiom {:extern }($arr_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -87,18 +87,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert true; } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -192,18 +192,21 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var arr$0_old: bv32; + var arr$0_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R9, Gamma_R9 := 69632bv64, true; R9, Gamma_R9 := bvadd64(R9, 52bv64), Gamma_R9; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x720"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, bvadd64(R9, 4bv64)) ==> Gamma_R8); arr$0_old := memory_load32_le(mem, bvadd64($arr_addr, 0bv64)); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 4bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 4bv64), Gamma_R8); assert (arr$0_old == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_arrays_write/clang_O2/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/clang_O2/basic_arrays_write.expected index 053d7afc8..d809dcc3f 100644 --- a/src/test/correct/basic_arrays_write/clang_O2/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/clang_O2/basic_arrays_write.expected @@ -1,36 +1,36 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $arr_addr: bv64; -axiom {:extern } ($arr_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$arr_addr: bv64; +axiom {:extern }($arr_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -71,7 +71,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -79,18 +79,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert true; } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -182,8 +182,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var arr$0_old: bv32; + var arr$0_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -192,5 +193,6 @@ procedure main() arr$0_old := memory_load32_le(mem, bvadd64($arr_addr, 0bv64)); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); assert (arr$0_old == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); + assume {:captureState "addr:0x720"}true; return; } diff --git a/src/test/correct/basic_arrays_write/clang_no_plt_no_pic/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/clang_no_plt_no_pic/basic_arrays_write.expected index fae95e38d..f8f5ec6b5 100644 --- a/src/test/correct/basic_arrays_write/clang_no_plt_no_pic/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/clang_no_plt_no_pic/basic_arrays_write.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $arr_addr: bv64; -axiom {:extern } ($arr_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$arr_addr: bv64; +axiom {:extern }($arr_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -87,18 +87,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert true; } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -192,18 +192,21 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var arr$0_old: bv32; + var arr$0_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R9, Gamma_R9 := 69632bv64, true; R9, Gamma_R9 := bvadd64(R9, 52bv64), Gamma_R9; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x720"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, bvadd64(R9, 4bv64)) ==> Gamma_R8); arr$0_old := memory_load32_le(mem, bvadd64($arr_addr, 0bv64)); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 4bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 4bv64), Gamma_R8); assert (arr$0_old == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_arrays_write/clang_pic/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/clang_pic/basic_arrays_write.expected index f99da0575..026bdc6e2 100644 --- a/src/test/correct/basic_arrays_write/clang_pic/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/clang_pic/basic_arrays_write.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $arr_addr: bv64; -axiom {:extern } ($arr_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$arr_addr: bv64; +axiom {:extern }($arr_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -95,7 +95,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -103,18 +103,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert true; } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -224,19 +224,22 @@ procedure main() free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { - var arr$0_old: bv32; + var arr$0_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4056bv64)) || L(mem, bvadd64(R9, 4056bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x760"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, bvadd64(R9, 4bv64)) ==> Gamma_R8); arr$0_old := memory_load32_le(mem, bvadd64($arr_addr, 0bv64)); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 4bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 4bv64), Gamma_R8); assert (arr$0_old == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_arrays_write/gcc/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/gcc/basic_arrays_write.expected index 21eaf4606..75be2e279 100644 --- a/src/test/correct/basic_arrays_write/gcc/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/gcc/basic_arrays_write.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $arr_addr: bv64; -axiom {:extern } ($arr_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$arr_addr: bv64; +axiom {:extern }($arr_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -85,18 +85,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert true; } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -190,10 +190,12 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var arr$0_old: bv32; + var arr$0_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); @@ -202,6 +204,7 @@ procedure main() arr$0_old := memory_load32_le(mem, bvadd64($arr_addr, 0bv64)); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R0, 4bv64), R1[32:0]), gamma_store32(Gamma_mem, bvadd64(R0, 4bv64), Gamma_R1); assert (arr$0_old == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_arrays_write/gcc_O2/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/gcc_O2/basic_arrays_write.expected index fe91e2770..185310dc9 100644 --- a/src/test/correct/basic_arrays_write/gcc_O2/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/gcc_O2/basic_arrays_write.expected @@ -1,36 +1,36 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $arr_addr: bv64; -axiom {:extern } ($arr_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$arr_addr: bv64; +axiom {:extern }($arr_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -71,7 +71,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -79,18 +79,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert true; } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -182,8 +182,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var arr$0_old: bv32; + var arr$0_old: bv32; lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 0bv64, true; @@ -192,5 +193,6 @@ procedure main() arr$0_old := memory_load32_le(mem, bvadd64($arr_addr, 0bv64)); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 28bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 28bv64), Gamma_R2); assert (arr$0_old == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); + assume {:captureState "addr:0x60c"}true; return; } diff --git a/src/test/correct/basic_arrays_write/gcc_no_plt_no_pic/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/gcc_no_plt_no_pic/basic_arrays_write.expected index 21eaf4606..75be2e279 100644 --- a/src/test/correct/basic_arrays_write/gcc_no_plt_no_pic/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/gcc_no_plt_no_pic/basic_arrays_write.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $arr_addr: bv64; -axiom {:extern } ($arr_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$arr_addr: bv64; +axiom {:extern }($arr_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -85,18 +85,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert true; } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -190,10 +190,12 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var arr$0_old: bv32; + var arr$0_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); @@ -202,6 +204,7 @@ procedure main() arr$0_old := memory_load32_le(mem, bvadd64($arr_addr, 0bv64)); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R0, 4bv64), R1[32:0]), gamma_store32(Gamma_mem, bvadd64(R0, 4bv64), Gamma_R1); assert (arr$0_old == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_arrays_write/gcc_pic/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/gcc_pic/basic_arrays_write.expected index 63d50027c..b86cc5bfe 100644 --- a/src/test/correct/basic_arrays_write/gcc_pic/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/gcc_pic/basic_arrays_write.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $arr_addr: bv64; -axiom {:extern } ($arr_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$arr_addr: bv64; +axiom {:extern }($arr_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -93,7 +93,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -101,18 +101,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert true; } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -222,10 +222,12 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var arr$0_old: bv32; + var arr$0_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x758"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4080bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4080bv64)) || L(mem, bvadd64(R0, 4080bv64))); @@ -235,6 +237,7 @@ procedure main() arr$0_old := memory_load32_le(mem, bvadd64($arr_addr, 0bv64)); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R0, 4bv64), R1[32:0]), gamma_store32(Gamma_mem, bvadd64(R0, 4bv64), Gamma_R1); assert (arr$0_old == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_assign_assign/clang/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/clang/basic_assign_assign.expected index 333197eb0..79f7e8bea 100644 --- a/src/test/correct/basic_assign_assign/clang/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/clang/basic_assign_assign.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -78,18 +78,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -182,8 +182,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 5bv64, true; call rely(); @@ -191,6 +192,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 5bv32)); + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_assign/clang_O2/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/clang_O2/basic_assign_assign.expected index 1f4ed84a3..9077f5b9d 100644 --- a/src/test/correct/basic_assign_assign/clang_O2/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/clang_O2/basic_assign_assign.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -78,18 +78,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -182,8 +182,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 5bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -192,5 +193,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); assert ((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 5bv32)); + assume {:captureState "addr:0x720"}true; return; } diff --git a/src/test/correct/basic_assign_assign/clang_no_plt_no_pic/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/clang_no_plt_no_pic/basic_assign_assign.expected index 333197eb0..79f7e8bea 100644 --- a/src/test/correct/basic_assign_assign/clang_no_plt_no_pic/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/clang_no_plt_no_pic/basic_assign_assign.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -78,18 +78,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -182,8 +182,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 5bv64, true; call rely(); @@ -191,6 +192,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 5bv32)); + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_assign/clang_pic/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/clang_pic/basic_assign_assign.expected index bb6b5b6bf..a79f954f2 100644 --- a/src/test/correct/basic_assign_assign/clang_pic/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/clang_pic/basic_assign_assign.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -86,7 +86,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -94,18 +94,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -214,8 +214,9 @@ procedure main() free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); @@ -225,6 +226,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert ((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 5bv32)); + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_assign/gcc/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/gcc/basic_assign_assign.expected index d57bc1507..493399a9b 100644 --- a/src/test/correct/basic_assign_assign/gcc/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/gcc/basic_assign_assign.expected @@ -1,33 +1,33 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -68,7 +68,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -76,18 +76,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -180,8 +180,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 5bv64, true; @@ -190,6 +191,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 5bv32)); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_assign/gcc_O2/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/gcc_O2/basic_assign_assign.expected index c90bb3830..8c5ad69c8 100644 --- a/src/test/correct/basic_assign_assign/gcc_O2/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/gcc_O2/basic_assign_assign.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -78,18 +78,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -182,8 +182,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 5bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -192,5 +193,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R2); assert ((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 5bv32)); + assume {:captureState "addr:0x60c"}true; return; } diff --git a/src/test/correct/basic_assign_assign/gcc_no_plt_no_pic/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/gcc_no_plt_no_pic/basic_assign_assign.expected index d57bc1507..493399a9b 100644 --- a/src/test/correct/basic_assign_assign/gcc_no_plt_no_pic/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/gcc_no_plt_no_pic/basic_assign_assign.expected @@ -1,33 +1,33 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -68,7 +68,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -76,18 +76,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -180,8 +180,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 5bv64, true; @@ -190,6 +191,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 5bv32)); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_assign/gcc_pic/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/gcc_pic/basic_assign_assign.expected index 2b6a307e2..9df5b4933 100644 --- a/src/test/correct/basic_assign_assign/gcc_pic/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/gcc_pic/basic_assign_assign.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -84,7 +84,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -92,18 +92,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -212,8 +212,9 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -223,6 +224,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 5bv32)); + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_increment/clang/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/clang/basic_assign_increment.expected index 3a38a4e20..eb5c00566 100644 --- a/src/test/correct/basic_assign_increment/clang/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/clang/basic_assign_increment.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -84,18 +84,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -188,8 +188,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R9, Gamma_R9 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R9, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R9, 52bv64)) || L(mem, bvadd64(R9, 52bv64))); @@ -199,6 +200,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert (((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_increment/clang_O2/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/clang_O2/basic_assign_increment.expected index f164f2fac..05ad161e1 100644 --- a/src/test/correct/basic_assign_increment/clang_O2/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/clang_O2/basic_assign_increment.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -84,18 +84,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -188,8 +188,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); @@ -200,5 +201,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); assert (((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); + assume {:captureState "addr:0x724"}true; return; } diff --git a/src/test/correct/basic_assign_increment/clang_no_plt_no_pic/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/clang_no_plt_no_pic/basic_assign_increment.expected index 3a38a4e20..eb5c00566 100644 --- a/src/test/correct/basic_assign_increment/clang_no_plt_no_pic/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/clang_no_plt_no_pic/basic_assign_increment.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -84,18 +84,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -188,8 +188,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R9, Gamma_R9 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R9, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R9, 52bv64)) || L(mem, bvadd64(R9, 52bv64))); @@ -199,6 +200,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert (((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_increment/clang_pic/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/clang_pic/basic_assign_increment.expected index 7e81511d4..1c3b1ec98 100644 --- a/src/test/correct/basic_assign_increment/clang_pic/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/clang_pic/basic_assign_increment.expected @@ -1,49 +1,49 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -92,7 +92,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -100,18 +100,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -220,8 +220,9 @@ procedure main() free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); @@ -233,6 +234,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert (((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); + assume {:captureState "addr:0x764"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_increment/gcc/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/gcc/basic_assign_increment.expected index 91e00fe99..60a051dbc 100644 --- a/src/test/correct/basic_assign_increment/gcc/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/gcc/basic_assign_increment.expected @@ -1,39 +1,39 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -74,7 +74,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -82,18 +82,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -186,8 +186,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -200,6 +201,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_increment/gcc_O2/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/gcc_O2/basic_assign_increment.expected index 071eff3fe..d839cbae8 100644 --- a/src/test/correct/basic_assign_increment/gcc_O2/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/gcc_O2/basic_assign_increment.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -84,18 +84,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -188,8 +188,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x600"}true; R2, Gamma_R2 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); @@ -200,5 +201,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R2, 20bv64), R1[32:0]), gamma_store32(Gamma_mem, bvadd64(R2, 20bv64), Gamma_R1); assert (((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); + assume {:captureState "addr:0x610"}true; return; } diff --git a/src/test/correct/basic_assign_increment/gcc_no_plt_no_pic/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/gcc_no_plt_no_pic/basic_assign_increment.expected index 91e00fe99..60a051dbc 100644 --- a/src/test/correct/basic_assign_increment/gcc_no_plt_no_pic/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/gcc_no_plt_no_pic/basic_assign_increment.expected @@ -1,39 +1,39 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -74,7 +74,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -82,18 +82,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -186,8 +186,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -200,6 +201,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_increment/gcc_pic/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/gcc_pic/basic_assign_increment.expected index 2fc495085..c47643c28 100644 --- a/src/test/correct/basic_assign_increment/gcc_pic/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/gcc_pic/basic_assign_increment.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -90,7 +90,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -98,18 +98,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -218,8 +218,9 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -234,6 +235,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); + assume {:captureState "addr:0x76c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_caller/clang/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/clang/basic_function_call_caller.expected index 227e1ffa9..a10273415 100644 --- a/src/test/correct/basic_function_call_caller/clang/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/clang/basic_function_call_caller.expected @@ -1,66 +1,66 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -102,7 +102,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -111,20 +111,20 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R29, R30, R31, R8, R9, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -220,23 +220,28 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_y_old: bool; - var x_old: bv32; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_y_old: bool; + var x_old: bv32; lmain: + assume {:captureState "addr:0x71c"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x720"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x720"}true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R0); + assume {:captureState "addr:0x728"}true; R30, Gamma_R30 := 1840bv64, true; call zero(); goto l00000321; l00000321: + assume {:captureState "addr:0x730"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R0); @@ -246,6 +251,7 @@ procedure main() assert ((bvadd64(R8, 52bv64) == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); + assume {:captureState "addr:0x734"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R29, 18446744073709551612bv64))), gamma_load32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); @@ -256,6 +262,7 @@ procedure main() assert ((bvadd64(R9, 56bv64) == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); + assume {:captureState "addr:0x740"}true; R0, Gamma_R0 := 0bv64, true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -264,7 +271,7 @@ procedure main() return; } -procedure zero() +procedure zero() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1896bv64) == 1bv8); free requires (memory_load8_le(mem, 1897bv64) == 0bv8); @@ -341,6 +348,7 @@ procedure zero() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lzero: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_caller/clang_O2/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/clang_O2/basic_function_call_caller.expected index 07bfa8d6c..5fbc30ede 100644 --- a/src/test/correct/basic_function_call_caller/clang_O2/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/clang_O2/basic_function_call_caller.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -80,7 +80,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -89,20 +89,20 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R8, R9, mem; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -194,9 +194,10 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_y_old: bool; - var x_old: bv32; + var Gamma_y_old: bool; + var x_old: bv32; lmain: + assume {:captureState "addr:0x71c"}true; R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 0bv64, true; R9, Gamma_R9 := 69632bv64, true; @@ -209,6 +210,7 @@ procedure main() assert ((bvadd64(R9, 52bv64) == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); + assume {:captureState "addr:0x72c"}true; call rely(); assert (L(mem, bvadd64(R10, 56bv64)) ==> Gamma_R8); x_old := memory_load32_le(mem, $x_addr); @@ -217,5 +219,6 @@ procedure main() assert ((bvadd64(R10, 56bv64) == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); + assume {:captureState "addr:0x730"}true; return; } diff --git a/src/test/correct/basic_function_call_caller/clang_no_plt_no_pic/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/clang_no_plt_no_pic/basic_function_call_caller.expected index b9313f306..7ef9fd5f4 100644 --- a/src/test/correct/basic_function_call_caller/clang_no_plt_no_pic/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/clang_no_plt_no_pic/basic_function_call_caller.expected @@ -1,66 +1,66 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -102,7 +102,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -111,20 +111,20 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R29, R30, R31, R8, R9, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -220,23 +220,28 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_y_old: bool; - var x_old: bv32; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_y_old: bool; + var x_old: bv32; lmain: + assume {:captureState "addr:0x71c"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x720"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x720"}true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R0); + assume {:captureState "addr:0x728"}true; R30, Gamma_R30 := 1840bv64, true; call zero(); goto l00000938; l00000938: + assume {:captureState "addr:0x730"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R0); @@ -246,6 +251,7 @@ procedure main() assert ((bvadd64(R8, 52bv64) == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); + assume {:captureState "addr:0x734"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R29, 18446744073709551612bv64))), gamma_load32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); @@ -256,6 +262,7 @@ procedure main() assert ((bvadd64(R9, 56bv64) == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); + assume {:captureState "addr:0x740"}true; R0, Gamma_R0 := 0bv64, true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -264,7 +271,7 @@ procedure main() return; } -procedure zero() +procedure zero() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1896bv64) == 1bv8); free requires (memory_load8_le(mem, 1897bv64) == 0bv8); @@ -341,6 +348,7 @@ procedure zero() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lzero: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_caller/clang_pic/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/clang_pic/basic_function_call_caller.expected index 46d4e2f30..44c1da5db 100644 --- a/src/test/correct/basic_function_call_caller/clang_pic/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/clang_pic/basic_function_call_caller.expected @@ -1,66 +1,66 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -118,7 +118,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -127,20 +127,20 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R29, R30, R31, R8, R9, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -268,23 +268,28 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_y_old: bool; - var x_old: bv32; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_y_old: bool; + var x_old: bv32; lmain: + assume {:captureState "addr:0x75c"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x760"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x760"}true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R0); + assume {:captureState "addr:0x768"}true; R30, Gamma_R30 := 1904bv64, true; call zero(); goto l00000329; l00000329: + assume {:captureState "addr:0x770"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -296,6 +301,7 @@ procedure main() assert ((R8 == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); + assume {:captureState "addr:0x778"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R29, 18446744073709551612bv64))), gamma_load32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64)); R9, Gamma_R9 := 65536bv64, true; call rely(); @@ -308,6 +314,7 @@ procedure main() assert ((R9 == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); + assume {:captureState "addr:0x788"}true; R0, Gamma_R0 := 0bv64, true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -316,7 +323,7 @@ procedure main() return; } -procedure zero() +procedure zero() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1968bv64) == 1bv8); free requires (memory_load8_le(mem, 1969bv64) == 0bv8); @@ -425,6 +432,7 @@ procedure zero() free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { lzero: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_caller/gcc/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/gcc/basic_function_call_caller.expected index 278aee3f4..7fc5cb92b 100644 --- a/src/test/correct/basic_function_call_caller/gcc/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/gcc/basic_function_call_caller.expected @@ -1,64 +1,64 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -100,7 +100,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -109,20 +109,20 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -218,21 +218,26 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; - var Gamma_y_old: bool; - var x_old: bv32; + var #4: bv64; + var Gamma_#4: bool; + var Gamma_y_old: bool; + var x_old: bv32; lmain: + assume {:captureState "addr:0x71c"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x71c"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x724"}true; R30, Gamma_R30 := 1836bv64, true; call zero(); goto l00000323; l00000323: + assume {:captureState "addr:0x72c"}true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; @@ -244,6 +249,7 @@ procedure main() assert ((R0 == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); @@ -255,6 +261,7 @@ procedure main() assert ((R0 == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -262,7 +269,7 @@ procedure main() return; } -procedure zero() +procedure zero() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1900bv64) == 1bv8); free requires (memory_load8_le(mem, 1901bv64) == 0bv8); @@ -339,6 +346,7 @@ procedure zero() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lzero: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_caller/gcc_O2/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/gcc_O2/basic_function_call_caller.expected index 680f6b812..d381cc1fc 100644 --- a/src/test/correct/basic_function_call_caller/gcc_O2/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/gcc_O2/basic_function_call_caller.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R3: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R3: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R3: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }R3: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -80,7 +80,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -89,20 +89,20 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R3, Gamma_mem, R0, R1, R2, R3, mem; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -194,9 +194,10 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_y_old: bool; - var x_old: bv32; + var Gamma_y_old: bool; + var x_old: bv32; lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R3, Gamma_R3 := zero_extend32_32(R0[32:0]), Gamma_R0; @@ -209,6 +210,7 @@ procedure main() assert ((bvadd64(R1, 20bv64) == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); + assume {:captureState "addr:0x610"}true; call rely(); assert (L(mem, bvadd64(R2, 4bv64)) ==> Gamma_R3); x_old := memory_load32_le(mem, $x_addr); @@ -217,5 +219,6 @@ procedure main() assert ((bvadd64(R2, 4bv64) == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); + assume {:captureState "addr:0x614"}true; return; } diff --git a/src/test/correct/basic_function_call_caller/gcc_no_plt_no_pic/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/gcc_no_plt_no_pic/basic_function_call_caller.expected index a9d652d5f..679815f97 100644 --- a/src/test/correct/basic_function_call_caller/gcc_no_plt_no_pic/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/gcc_no_plt_no_pic/basic_function_call_caller.expected @@ -1,64 +1,64 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -100,7 +100,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -109,20 +109,20 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -218,21 +218,26 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; - var Gamma_y_old: bool; - var x_old: bv32; + var #4: bv64; + var Gamma_#4: bool; + var Gamma_y_old: bool; + var x_old: bv32; lmain: + assume {:captureState "addr:0x71c"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x71c"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x724"}true; R30, Gamma_R30 := 1836bv64, true; call zero(); goto l0000094a; l0000094a: + assume {:captureState "addr:0x72c"}true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; @@ -244,6 +249,7 @@ procedure main() assert ((R0 == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); @@ -255,6 +261,7 @@ procedure main() assert ((R0 == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -262,7 +269,7 @@ procedure main() return; } -procedure zero() +procedure zero() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1900bv64) == 1bv8); free requires (memory_load8_le(mem, 1901bv64) == 0bv8); @@ -339,6 +346,7 @@ procedure zero() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lzero: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_caller/gcc_pic/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/gcc_pic/basic_function_call_caller.expected index 88ee802ac..af7d75a4b 100644 --- a/src/test/correct/basic_function_call_caller/gcc_pic/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/gcc_pic/basic_function_call_caller.expected @@ -1,64 +1,64 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -116,7 +116,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -125,20 +125,20 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -266,21 +266,26 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; - var Gamma_y_old: bool; - var x_old: bv32; + var #4: bv64; + var Gamma_#4: bool; + var Gamma_y_old: bool; + var x_old: bv32; lmain: + assume {:captureState "addr:0x75c"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x75c"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x75c"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x764"}true; R30, Gamma_R30 := 1900bv64, true; call zero(); goto l00000323; l00000323: + assume {:captureState "addr:0x76c"}true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -293,6 +298,7 @@ procedure main() assert ((R0 == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -305,6 +311,7 @@ procedure main() assert ((R0 == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); + assume {:captureState "addr:0x788"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -312,7 +319,7 @@ procedure main() return; } -procedure zero() +procedure zero() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1964bv64) == 1bv8); free requires (memory_load8_le(mem, 1965bv64) == 0bv8); @@ -421,6 +428,7 @@ procedure zero() free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { lzero: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_reader/clang/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/clang/basic_function_call_reader.expected index 2ca124372..682ce7324 100644 --- a/src/test/correct/basic_function_call_reader/clang/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/clang/basic_function_call_reader.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -88,7 +88,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -97,20 +97,20 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -203,23 +203,26 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); @@ -247,15 +250,21 @@ procedure main() } goto l0000037a; l00000350: + assume {:captureState "addr:0x748"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x74c"}true; goto l00000365; l0000037a: + assume {:captureState "addr:0x73c"}true; goto l0000037b; l0000037b: + assume {:captureState "addr:0x740"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x740"}true; goto l00000365; l00000365: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_function_call_reader/clang_O2/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/clang_O2/basic_function_call_reader.expected index d1bccd69c..2529e078a 100644 --- a/src/test/correct/basic_function_call_reader/clang_O2/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/clang_O2/basic_function_call_reader.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -78,7 +78,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -87,20 +87,20 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -191,17 +191,18 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); diff --git a/src/test/correct/basic_function_call_reader/clang_no_plt_no_pic/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/clang_no_plt_no_pic/basic_function_call_reader.expected index 402cd9af2..6466cd9a6 100644 --- a/src/test/correct/basic_function_call_reader/clang_no_plt_no_pic/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/clang_no_plt_no_pic/basic_function_call_reader.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -88,7 +88,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -97,20 +97,20 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -203,23 +203,26 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); @@ -247,15 +250,21 @@ procedure main() } goto l000009bd; l00000993: + assume {:captureState "addr:0x748"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x74c"}true; goto l000009a8; l000009bd: + assume {:captureState "addr:0x73c"}true; goto l000009be; l000009be: + assume {:captureState "addr:0x740"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x740"}true; goto l000009a8; l000009a8: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_function_call_reader/clang_pic/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/clang_pic/basic_function_call_reader.expected index da79410ad..edf97b8b3 100644 --- a/src/test/correct/basic_function_call_reader/clang_pic/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/clang_pic/basic_function_call_reader.expected @@ -1,60 +1,60 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -112,7 +112,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -121,20 +121,20 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -259,25 +259,28 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x758"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4048bv64)) || L(mem, bvadd64(R8, 4048bv64))); call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x768"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -307,15 +310,21 @@ procedure main() } goto l00000390; l00000366: + assume {:captureState "addr:0x790"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x794"}true; goto l0000037b; l00000390: + assume {:captureState "addr:0x784"}true; goto l00000391; l00000391: + assume {:captureState "addr:0x788"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x788"}true; goto l0000037b; l0000037b: + assume {:captureState "addr:0x79c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_function_call_reader/gcc/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/gcc/basic_function_call_reader.expected index a60cd0066..ff841269b 100644 --- a/src/test/correct/basic_function_call_reader/gcc/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/gcc/basic_function_call_reader.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -86,7 +86,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -95,20 +95,20 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -201,23 +201,25 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x724"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -233,12 +235,15 @@ procedure main() } goto l00000349; l00000332: + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); goto l0000033e; l00000349: + assume {:captureState "addr:0x73c"}true; R0, Gamma_R0 := 0bv64, true; goto l0000033e; l0000033e: + assume {:captureState "addr:0x748"}true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_function_call_reader/gcc_O2/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/gcc_O2/basic_function_call_reader.expected index 827481efc..e872eb01d 100644 --- a/src/test/correct/basic_function_call_reader/gcc_O2/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/gcc_O2/basic_function_call_reader.expected @@ -1,33 +1,33 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -69,7 +69,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -78,20 +78,20 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -183,6 +183,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; R0, Gamma_R0 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -193,9 +194,11 @@ procedure main() } goto l00000398; l00000398: + assume {:captureState "addr:0x610"}true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 4bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 4bv64)) || L(mem, bvadd64(R1, 4bv64))); goto l000001bc; l000001bc: + assume {:captureState "addr:0x614"}true; return; } diff --git a/src/test/correct/basic_function_call_reader/gcc_no_plt_no_pic/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/gcc_no_plt_no_pic/basic_function_call_reader.expected index 5d4078242..52411ea30 100644 --- a/src/test/correct/basic_function_call_reader/gcc_no_plt_no_pic/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/gcc_no_plt_no_pic/basic_function_call_reader.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -86,7 +86,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -95,20 +95,20 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -201,23 +201,25 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x724"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -233,12 +235,15 @@ procedure main() } goto l0000094e; l00000937: + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); goto l00000943; l0000094e: + assume {:captureState "addr:0x73c"}true; R0, Gamma_R0 := 0bv64, true; goto l00000943; l00000943: + assume {:captureState "addr:0x748"}true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_function_call_reader/gcc_pic/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/gcc_pic/basic_function_call_reader.expected index 23420a907..09c74a7fb 100644 --- a/src/test/correct/basic_function_call_reader/gcc_pic/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/gcc_pic/basic_function_call_reader.expected @@ -1,58 +1,58 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -110,7 +110,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -119,20 +119,20 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -257,17 +257,18 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -275,6 +276,7 @@ procedure main() call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x764"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -291,12 +293,15 @@ procedure main() } goto l0000034b; l00000334: + assume {:captureState "addr:0x784"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); goto l00000340; l0000034b: + assume {:captureState "addr:0x77c"}true; R0, Gamma_R0 := 0bv64, true; goto l00000340; l00000340: + assume {:captureState "addr:0x788"}true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_lock_read/clang/basic_lock_read.expected b/src/test/correct/basic_lock_read/clang/basic_lock_read.expected index 8c7429171..22fd43f64 100644 --- a/src/test/correct/basic_lock_read/clang/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/clang/basic_lock_read.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -95,18 +95,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -200,21 +200,24 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; - var z_old: bv32; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); + assume {:captureState "addr:0x71c"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -242,19 +245,24 @@ procedure main() } goto l00000352; l00000352: + assume {:captureState "addr:0x734"}true; goto l00000353; l00000353: + assume {:captureState "addr:0x738"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); assert (memory_load32_le(mem, $z_addr) == z_old); + assume {:captureState "addr:0x73c"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x744"}true; goto l0000033b; l0000033b: + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_read/clang_O2/basic_lock_read.expected b/src/test/correct/basic_lock_read/clang_O2/basic_lock_read.expected index 766186715..1e52ae958 100644 --- a/src/test/correct/basic_lock_read/clang_O2/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/clang_O2/basic_lock_read.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -84,18 +84,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_mem, R0, R8, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -187,8 +187,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var z_old: bv32; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -198,15 +199,18 @@ procedure main() } goto l000002f7; l000002dc: + assume {:captureState "addr:0x728"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); assert (memory_load32_le(mem, $z_addr) == z_old); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := 0bv64, true; return; l000002f7: + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_lock_read/clang_no_plt_no_pic/basic_lock_read.expected b/src/test/correct/basic_lock_read/clang_no_plt_no_pic/basic_lock_read.expected index c8bde52f3..1aa1173c4 100644 --- a/src/test/correct/basic_lock_read/clang_no_plt_no_pic/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/clang_no_plt_no_pic/basic_lock_read.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -95,18 +95,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -200,21 +200,24 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; - var z_old: bv32; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); + assume {:captureState "addr:0x71c"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -242,19 +245,24 @@ procedure main() } goto l0000097d; l0000097d: + assume {:captureState "addr:0x734"}true; goto l0000097e; l0000097e: + assume {:captureState "addr:0x738"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); assert (memory_load32_le(mem, $z_addr) == z_old); + assume {:captureState "addr:0x73c"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x744"}true; goto l00000966; l00000966: + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_read/clang_pic/basic_lock_read.expected b/src/test/correct/basic_lock_read/clang_pic/basic_lock_read.expected index f14fdff0e..850826886 100644 --- a/src/test/correct/basic_lock_read/clang_pic/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/clang_pic/basic_lock_read.expected @@ -1,60 +1,60 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -111,7 +111,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -119,18 +119,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -256,21 +256,24 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; - var z_old: bv32; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; + var z_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x758"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); + assume {:captureState "addr:0x75c"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -300,8 +303,10 @@ procedure main() } goto l00000361; l00000361: + assume {:captureState "addr:0x778"}true; goto l00000362; l00000362: + assume {:captureState "addr:0x77c"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4040bv64)) || L(mem, bvadd64(R8, 4040bv64))); @@ -310,11 +315,14 @@ procedure main() z_old := memory_load32_le(mem, $z_addr); mem, Gamma_mem := memory_store32_le(mem, R8, 0bv32), gamma_store32(Gamma_mem, R8, true); assert (memory_load32_le(mem, $z_addr) == z_old); + assume {:captureState "addr:0x784"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x78c"}true; goto l0000034a; l0000034a: + assume {:captureState "addr:0x794"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_read/gcc/basic_lock_read.expected b/src/test/correct/basic_lock_read/gcc/basic_lock_read.expected index 617fd90e2..d69adfe90 100644 --- a/src/test/correct/basic_lock_read/gcc/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/gcc/basic_lock_read.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -93,18 +93,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -198,20 +198,22 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; - var z_old: bv32; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -227,6 +229,7 @@ procedure main() } goto l0000033e; l0000033e: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -234,13 +237,16 @@ procedure main() z_old := memory_load32_le(mem, $z_addr); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert (memory_load32_le(mem, $z_addr) == z_old); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x748"}true; goto l00000327; l00000327: + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_read/gcc_O2/basic_lock_read.expected b/src/test/correct/basic_lock_read/gcc_O2/basic_lock_read.expected index 63f6b7e5f..37026eb07 100644 --- a/src/test/correct/basic_lock_read/gcc_O2/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/gcc_O2/basic_lock_read.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69656bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69656bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -85,18 +85,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -188,8 +188,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var z_old: bv32; + var z_old: bv32; lmain: + assume {:captureState "addr:0x600"}true; R0, Gamma_R0 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -200,13 +201,16 @@ procedure main() } goto l0000039c; l0000039c: + assume {:captureState "addr:0x610"}true; call rely(); assert (L(mem, bvadd64(R1, 4bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 4bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R1, 4bv64), true); assert (memory_load32_le(mem, $z_addr) == z_old); + assume {:captureState "addr:0x610"}true; goto l000001bd; l000001bd: + assume {:captureState "addr:0x614"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_lock_read/gcc_no_plt_no_pic/basic_lock_read.expected b/src/test/correct/basic_lock_read/gcc_no_plt_no_pic/basic_lock_read.expected index cfaa71516..eda8d8e1d 100644 --- a/src/test/correct/basic_lock_read/gcc_no_plt_no_pic/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/gcc_no_plt_no_pic/basic_lock_read.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -93,18 +93,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -198,20 +198,22 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; - var z_old: bv32; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -227,6 +229,7 @@ procedure main() } goto l0000095f; l0000095f: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -234,13 +237,16 @@ procedure main() z_old := memory_load32_le(mem, $z_addr); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert (memory_load32_le(mem, $z_addr) == z_old); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x748"}true; goto l00000948; l00000948: + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_read/gcc_pic/basic_lock_read.expected b/src/test/correct/basic_lock_read/gcc_pic/basic_lock_read.expected index 0b39900de..924c0f016 100644 --- a/src/test/correct/basic_lock_read/gcc_pic/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/gcc_pic/basic_lock_read.expected @@ -1,58 +1,58 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -109,7 +109,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -117,18 +117,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -254,20 +254,22 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; - var z_old: bv32; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; + var z_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x758"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -284,6 +286,7 @@ procedure main() } goto l0000033f; l0000033f: + assume {:captureState "addr:0x770"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -292,14 +295,17 @@ procedure main() z_old := memory_load32_le(mem, $z_addr); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert (memory_load32_le(mem, $z_addr) == z_old); + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x788"}true; goto l00000328; l00000328: + assume {:captureState "addr:0x78c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_read/clang/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/clang/basic_lock_security_read.expected index c11b39962..b9ea1d366 100644 --- a/src/test/correct/basic_lock_security_read/clang/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/clang/basic_lock_security_read.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -95,18 +95,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -199,20 +199,23 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); + assume {:captureState "addr:0x71c"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -240,14 +243,18 @@ procedure main() } goto l0000034e; l0000034e: + assume {:captureState "addr:0x734"}true; goto l0000034f; l0000034f: + assume {:captureState "addr:0x738"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x740"}true; goto l00000337; l00000337: + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_read/clang_O2/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/clang_O2/basic_lock_security_read.expected index b1630aa80..571be95a3 100644 --- a/src/test/correct/basic_lock_security_read/clang_O2/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/clang_O2/basic_lock_security_read.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -85,18 +85,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -187,17 +187,18 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); diff --git a/src/test/correct/basic_lock_security_read/clang_no_plt_no_pic/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/clang_no_plt_no_pic/basic_lock_security_read.expected index 8c9b50bd0..a0bc8c357 100644 --- a/src/test/correct/basic_lock_security_read/clang_no_plt_no_pic/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/clang_no_plt_no_pic/basic_lock_security_read.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -95,18 +95,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -199,20 +199,23 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); + assume {:captureState "addr:0x71c"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -240,14 +243,18 @@ procedure main() } goto l0000096c; l0000096c: + assume {:captureState "addr:0x734"}true; goto l0000096d; l0000096d: + assume {:captureState "addr:0x738"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x740"}true; goto l00000955; l00000955: + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_read/clang_pic/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/clang_pic/basic_lock_security_read.expected index 9e341d77a..68ce0c704 100644 --- a/src/test/correct/basic_lock_security_read/clang_pic/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/clang_pic/basic_lock_security_read.expected @@ -1,60 +1,60 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -111,7 +111,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -119,18 +119,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -255,20 +255,23 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x758"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); + assume {:captureState "addr:0x75c"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -298,16 +301,20 @@ procedure main() } goto l0000035d; l0000035d: + assume {:captureState "addr:0x778"}true; goto l0000035e; l0000035e: + assume {:captureState "addr:0x77c"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4040bv64)) || L(mem, bvadd64(R8, 4040bv64))); call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x788"}true; goto l00000346; l00000346: + assume {:captureState "addr:0x790"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_read/gcc/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/gcc/basic_lock_security_read.expected index ecdcf29f9..8ba373a5c 100644 --- a/src/test/correct/basic_lock_security_read/gcc/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/gcc/basic_lock_security_read.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -93,18 +93,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -197,19 +197,21 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -225,13 +227,16 @@ procedure main() } goto l00000332; l00000332: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x73c"}true; goto l0000031b; l0000031b: + assume {:captureState "addr:0x740"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_read/gcc_O2/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/gcc_O2/basic_lock_security_read.expected index 1b6d448e7..cd0ed4b17 100644 --- a/src/test/correct/basic_lock_security_read/gcc_O2/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/gcc_O2/basic_lock_security_read.expected @@ -1,36 +1,36 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69656bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69656bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -71,7 +71,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -79,18 +79,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -182,6 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; @@ -193,9 +194,11 @@ procedure main() } goto l0000039c; l0000039c: + assume {:captureState "addr:0x614"}true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R2, 4bv64))), (gamma_load32(Gamma_mem, bvadd64(R2, 4bv64)) || L(mem, bvadd64(R2, 4bv64))); goto l000001c2; l000001c2: + assume {:captureState "addr:0x618"}true; return; } diff --git a/src/test/correct/basic_lock_security_read/gcc_no_plt_no_pic/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/gcc_no_plt_no_pic/basic_lock_security_read.expected index d699a2582..bd67c46dc 100644 --- a/src/test/correct/basic_lock_security_read/gcc_no_plt_no_pic/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/gcc_no_plt_no_pic/basic_lock_security_read.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -93,18 +93,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -197,19 +197,21 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -225,13 +227,16 @@ procedure main() } goto l0000092f; l0000092f: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x73c"}true; goto l00000918; l00000918: + assume {:captureState "addr:0x740"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_read/gcc_pic/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/gcc_pic/basic_lock_security_read.expected index b91bc2beb..4f6536f8d 100644 --- a/src/test/correct/basic_lock_security_read/gcc_pic/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/gcc_pic/basic_lock_security_read.expected @@ -1,58 +1,58 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -109,7 +109,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -117,18 +117,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -253,19 +253,21 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x758"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -282,14 +284,17 @@ procedure main() } goto l00000333; l00000333: + assume {:captureState "addr:0x770"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x77c"}true; goto l0000031c; l0000031c: + assume {:captureState "addr:0x780"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_write/clang/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/clang/basic_lock_security_write.expected index cb151d6c3..24daf725a 100644 --- a/src/test/correct/basic_lock_security_write/clang/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/clang/basic_lock_security_write.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -91,18 +91,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; requires (memory_load32_le(mem, $z_addr) != 0bv32); requires (Gamma_R0 == false); @@ -197,12 +197,14 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; - var x_old: bv32; - var z_old: bv32; + var Gamma_x_old: bool; + var x_old: bv32; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; call rely(); @@ -213,6 +215,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); assert ((bvadd64(R8, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x724"}true; R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); @@ -223,6 +226,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R10); assert ((bvadd64(R9, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> true); @@ -232,6 +236,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), true); assert ((bvadd64(R9, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x738"}true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); @@ -240,6 +245,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), true); assert ((bvadd64(R8, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x73c"}true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_lock_security_write/clang_O2/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/clang_O2/basic_lock_security_write.expected index 107a1ada4..c6578965b 100644 --- a/src/test/correct/basic_lock_security_write/clang_O2/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/clang_O2/basic_lock_security_write.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -84,18 +84,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $z_addr) != 0bv32); requires (Gamma_R0 == false); @@ -188,10 +188,11 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; - var x_old: bv32; - var z_old: bv32; + var Gamma_x_old: bool; + var x_old: bv32; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; @@ -203,6 +204,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); assert ((bvadd64(R8, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x720"}true; call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); @@ -211,5 +213,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), true); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x724"}true; return; } diff --git a/src/test/correct/basic_lock_security_write/clang_no_plt_no_pic/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/clang_no_plt_no_pic/basic_lock_security_write.expected index cb151d6c3..24daf725a 100644 --- a/src/test/correct/basic_lock_security_write/clang_no_plt_no_pic/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/clang_no_plt_no_pic/basic_lock_security_write.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -91,18 +91,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; requires (memory_load32_le(mem, $z_addr) != 0bv32); requires (Gamma_R0 == false); @@ -197,12 +197,14 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; - var x_old: bv32; - var z_old: bv32; + var Gamma_x_old: bool; + var x_old: bv32; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; call rely(); @@ -213,6 +215,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); assert ((bvadd64(R8, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x724"}true; R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); @@ -223,6 +226,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R10); assert ((bvadd64(R9, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> true); @@ -232,6 +236,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), true); assert ((bvadd64(R9, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x738"}true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); @@ -240,6 +245,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), true); assert ((bvadd64(R8, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x73c"}true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_lock_security_write/clang_pic/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/clang_pic/basic_lock_security_write.expected index a420c2740..9df716c53 100644 --- a/src/test/correct/basic_lock_security_write/clang_pic/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/clang_pic/basic_lock_security_write.expected @@ -1,56 +1,56 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -107,7 +107,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -115,18 +115,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; requires (memory_load32_le(mem, $z_addr) != 0bv32); requires (Gamma_R0 == false); @@ -253,12 +253,14 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var Gamma_x_old: bool; - var x_old: bv32; - var z_old: bv32; + var Gamma_x_old: bool; + var x_old: bv32; + var z_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x758"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -271,6 +273,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R8, R9[32:0]), gamma_store32(Gamma_mem, R8, Gamma_R9); assert ((R8 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x768"}true; R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := 65536bv64, true; call rely(); @@ -283,6 +286,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R9, R10[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R10); assert ((R9 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, R9) ==> true); @@ -292,6 +296,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R9, 0bv32), gamma_store32(Gamma_mem, R9, true); assert ((R9 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x780"}true; call rely(); assert (L(mem, R8) ==> true); z_old := memory_load32_le(mem, $z_addr); @@ -300,6 +305,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R8, 0bv32), gamma_store32(Gamma_mem, R8, true); assert ((R8 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x784"}true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_lock_security_write/gcc/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/gcc/basic_lock_security_write.expected index 990e89dde..cc85715b0 100644 --- a/src/test/correct/basic_lock_security_write/gcc/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/gcc/basic_lock_security_write.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -87,18 +87,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; requires (memory_load32_le(mem, $z_addr) != 0bv32); requires (Gamma_R0 == false); @@ -193,12 +193,14 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; - var x_old: bv32; - var z_old: bv32; + var Gamma_x_old: bool; + var x_old: bv32; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -210,6 +212,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); @@ -221,6 +224,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -231,6 +235,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -241,6 +246,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x750"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_write/gcc_O2/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/gcc_O2/basic_lock_security_write.expected index 2e79d72cd..d76f52173 100644 --- a/src/test/correct/basic_lock_security_write/gcc_O2/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/gcc_O2/basic_lock_security_write.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -84,18 +84,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; requires (memory_load32_le(mem, $z_addr) != 0bv32); requires (Gamma_R0 == false); @@ -188,10 +188,11 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; - var x_old: bv32; - var z_old: bv32; + var Gamma_x_old: bool; + var x_old: bv32; + var z_old: bv32; lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; @@ -203,6 +204,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), true); assert ((bvadd64(R1, 20bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x60c"}true; call rely(); assert (L(mem, bvadd64(R2, 4bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); @@ -211,5 +213,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R2, 4bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R2, 4bv64), true); assert ((bvadd64(R2, 4bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x610"}true; return; } diff --git a/src/test/correct/basic_lock_security_write/gcc_no_plt_no_pic/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/gcc_no_plt_no_pic/basic_lock_security_write.expected index 990e89dde..cc85715b0 100644 --- a/src/test/correct/basic_lock_security_write/gcc_no_plt_no_pic/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/gcc_no_plt_no_pic/basic_lock_security_write.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -87,18 +87,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; requires (memory_load32_le(mem, $z_addr) != 0bv32); requires (Gamma_R0 == false); @@ -193,12 +193,14 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; - var x_old: bv32; - var z_old: bv32; + var Gamma_x_old: bool; + var x_old: bv32; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -210,6 +212,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); @@ -221,6 +224,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -231,6 +235,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -241,6 +246,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x750"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_write/gcc_pic/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/gcc_pic/basic_lock_security_write.expected index 4c505d5c8..1289cc1d0 100644 --- a/src/test/correct/basic_lock_security_write/gcc_pic/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/gcc_pic/basic_lock_security_write.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -103,7 +103,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -111,18 +111,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; requires (memory_load32_le(mem, $z_addr) != 0bv32); requires (Gamma_R0 == false); @@ -249,12 +249,14 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var Gamma_x_old: bool; - var x_old: bv32; - var z_old: bv32; + var Gamma_x_old: bool; + var x_old: bv32; + var z_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x758"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -267,6 +269,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -279,6 +282,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -290,6 +294,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x784"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -301,6 +306,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x790"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_unlock/clang/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/clang/basic_lock_unlock.expected index cc507074a..8b9536cd6 100644 --- a/src/test/correct/basic_lock_unlock/clang/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/clang/basic_lock_unlock.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -80,18 +80,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $z_addr) == 1bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -183,9 +183,10 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; - var z_old: bv32; + var x_old: bv32; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -194,6 +195,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x71c"}true; R8, Gamma_R8 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); @@ -202,5 +204,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x728"}true; return; } diff --git a/src/test/correct/basic_lock_unlock/clang_O2/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/clang_O2/basic_lock_unlock.expected index 83635e876..e5fa90b68 100644 --- a/src/test/correct/basic_lock_unlock/clang_O2/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/clang_O2/basic_lock_unlock.expected @@ -1,39 +1,39 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -74,7 +74,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -82,18 +82,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R8, R9, mem; requires (memory_load32_le(mem, $z_addr) == 1bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -185,9 +185,10 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; - var z_old: bv32; + var x_old: bv32; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; @@ -198,11 +199,13 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x724"}true; call rely(); assert (L(mem, bvadd64(R10, 56bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R10, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R10, 56bv64), true); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x728"}true; return; } diff --git a/src/test/correct/basic_lock_unlock/clang_no_plt_no_pic/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/clang_no_plt_no_pic/basic_lock_unlock.expected index cc507074a..8b9536cd6 100644 --- a/src/test/correct/basic_lock_unlock/clang_no_plt_no_pic/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/clang_no_plt_no_pic/basic_lock_unlock.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -80,18 +80,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $z_addr) == 1bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -183,9 +183,10 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; - var z_old: bv32; + var x_old: bv32; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -194,6 +195,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x71c"}true; R8, Gamma_R8 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); @@ -202,5 +204,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x728"}true; return; } diff --git a/src/test/correct/basic_lock_unlock/clang_pic/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/clang_pic/basic_lock_unlock.expected index 102500723..5d1ee5164 100644 --- a/src/test/correct/basic_lock_unlock/clang_pic/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/clang_pic/basic_lock_unlock.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -96,7 +96,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -104,18 +104,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $z_addr) == 1bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -239,9 +239,10 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var x_old: bv32; - var z_old: bv32; + var x_old: bv32; + var z_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); @@ -252,6 +253,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x760"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -262,5 +264,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R8, 0bv32), gamma_store32(Gamma_mem, R8, true); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x770"}true; return; } diff --git a/src/test/correct/basic_lock_unlock/gcc/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/gcc/basic_lock_unlock.expected index 57014effc..c7c3d5b67 100644 --- a/src/test/correct/basic_lock_unlock/gcc/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/gcc/basic_lock_unlock.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -78,18 +78,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $z_addr) == 1bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -181,9 +181,10 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; - var z_old: bv32; + var x_old: bv32; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -193,6 +194,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -201,6 +203,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_lock_unlock/gcc_O2/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/gcc_O2/basic_lock_unlock.expected index 9833f1173..cb994b9e1 100644 --- a/src/test/correct/basic_lock_unlock/gcc_O2/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/gcc_O2/basic_lock_unlock.expected @@ -1,39 +1,39 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R3: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R3: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R3: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }R3: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -74,7 +74,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -82,18 +82,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R3, Gamma_mem, R0, R1, R2, R3, mem; requires (memory_load32_le(mem, $z_addr) == 1bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -185,9 +185,10 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; - var z_old: bv32; + var x_old: bv32; + var z_old: bv32; lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R3, Gamma_R3 := 1bv64, true; @@ -198,11 +199,13 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R3[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R3); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x610"}true; call rely(); assert (L(mem, bvadd64(R2, 4bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R2, 4bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R2, 4bv64), true); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x614"}true; return; } diff --git a/src/test/correct/basic_lock_unlock/gcc_no_plt_no_pic/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/gcc_no_plt_no_pic/basic_lock_unlock.expected index 57014effc..c7c3d5b67 100644 --- a/src/test/correct/basic_lock_unlock/gcc_no_plt_no_pic/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/gcc_no_plt_no_pic/basic_lock_unlock.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -78,18 +78,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $z_addr) == 1bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -181,9 +181,10 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; - var z_old: bv32; + var x_old: bv32; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -193,6 +194,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -201,6 +203,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_lock_unlock/gcc_pic/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/gcc_pic/basic_lock_unlock.expected index 4c09ab473..ad9e338ed 100644 --- a/src/test/correct/basic_lock_unlock/gcc_pic/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/gcc_pic/basic_lock_unlock.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -94,7 +94,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -102,18 +102,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $z_addr) == 1bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -237,9 +237,10 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var x_old: bv32; - var z_old: bv32; + var x_old: bv32; + var z_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -250,6 +251,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -259,6 +261,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); + assume {:captureState "addr:0x76c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_loop_assign/clang/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/clang/basic_loop_assign.expected index ccaa7b136..d8438552b 100644 --- a/src/test/correct/basic_loop_assign/clang/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/clang/basic_loop_assign.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"}bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"}bvslt32(bv32, bv32) returns (bool); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -80,18 +80,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -184,8 +184,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 20bv64, true; call rely(); @@ -193,6 +194,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert (((memory_load32_le(mem, $x_addr) == x_old) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (x_old == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(x_old, 10bv32))); + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_loop_assign/clang_O2/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/clang_O2/basic_loop_assign.expected index 2b8d4a303..e70e4ae90 100644 --- a/src/test/correct/basic_loop_assign/clang_O2/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/clang_O2/basic_loop_assign.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"}bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"}bvslt32(bv32, bv32) returns (bool); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -80,18 +80,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -184,8 +184,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 20bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -194,5 +195,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); assert (((memory_load32_le(mem, $x_addr) == x_old) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (x_old == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(x_old, 10bv32))); + assume {:captureState "addr:0x720"}true; return; } diff --git a/src/test/correct/basic_loop_assign/clang_no_plt_no_pic/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/clang_no_plt_no_pic/basic_loop_assign.expected index ccaa7b136..d8438552b 100644 --- a/src/test/correct/basic_loop_assign/clang_no_plt_no_pic/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/clang_no_plt_no_pic/basic_loop_assign.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"}bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"}bvslt32(bv32, bv32) returns (bool); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -80,18 +80,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -184,8 +184,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 20bv64, true; call rely(); @@ -193,6 +194,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert (((memory_load32_le(mem, $x_addr) == x_old) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (x_old == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(x_old, 10bv32))); + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_loop_assign/clang_pic/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/clang_pic/basic_loop_assign.expected index f9c8066b1..ef03cf161 100644 --- a/src/test/correct/basic_loop_assign/clang_pic/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/clang_pic/basic_loop_assign.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"}bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"}bvslt32(bv32, bv32) returns (bool); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -88,7 +88,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -96,18 +96,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -216,8 +216,9 @@ procedure main() free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); @@ -227,6 +228,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert (((memory_load32_le(mem, $x_addr) == x_old) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (x_old == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(x_old, 10bv32))); + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_loop_assign/gcc/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/gcc/basic_loop_assign.expected index 96cc29efe..bdb3e223c 100644 --- a/src/test/correct/basic_loop_assign/gcc/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/gcc/basic_loop_assign.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"}bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"}bvslt32(bv32, bv32) returns (bool); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -78,18 +78,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -182,8 +182,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 20bv64, true; @@ -192,6 +193,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (((memory_load32_le(mem, $x_addr) == x_old) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (x_old == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(x_old, 10bv32))); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_loop_assign/gcc_O2/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/gcc_O2/basic_loop_assign.expected index 5780fc9d1..de64496b6 100644 --- a/src/test/correct/basic_loop_assign/gcc_O2/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/gcc_O2/basic_loop_assign.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"}bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"}bvslt32(bv32, bv32) returns (bool); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -80,18 +80,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -184,8 +184,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 20bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -194,5 +195,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R2); assert (((memory_load32_le(mem, $x_addr) == x_old) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (x_old == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(x_old, 10bv32))); + assume {:captureState "addr:0x60c"}true; return; } diff --git a/src/test/correct/basic_loop_assign/gcc_no_plt_no_pic/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/gcc_no_plt_no_pic/basic_loop_assign.expected index 96cc29efe..bdb3e223c 100644 --- a/src/test/correct/basic_loop_assign/gcc_no_plt_no_pic/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/gcc_no_plt_no_pic/basic_loop_assign.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"}bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"}bvslt32(bv32, bv32) returns (bool); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -78,18 +78,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -182,8 +182,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 20bv64, true; @@ -192,6 +193,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (((memory_load32_le(mem, $x_addr) == x_old) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (x_old == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(x_old, 10bv32))); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_loop_assign/gcc_pic/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/gcc_pic/basic_loop_assign.expected index abdc8d4d2..b473c8028 100644 --- a/src/test/correct/basic_loop_assign/gcc_pic/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/gcc_pic/basic_loop_assign.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"}bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"}bvslt32(bv32, bv32) returns (bool); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -86,7 +86,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -94,18 +94,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (memory_load32_le(mem, $x_addr) == 0bv32); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -214,8 +214,9 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -225,6 +226,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (((memory_load32_le(mem, $x_addr) == x_old) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (x_old == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(x_old, 10bv32))); + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_operation_evaluation/clang/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/clang/basic_operation_evaluation.expected index acb697510..6e420eccc 100644 --- a/src/test/correct/basic_operation_evaluation/clang/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/clang/basic_operation_evaluation.expected @@ -1,64 +1,64 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1952bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R10: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1952bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvmul"}bvmul64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot32(bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvor"}bvor32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvsdiv"}bvsdiv33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvxor"}bvxor32(bv32, bv32) returns (bv32); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -99,7 +99,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -108,12 +108,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_stack, R0, R10, R31, R8, R9, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -206,41 +206,51 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); + assume {:captureState "addr:0x720"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); + assume {:captureState "addr:0x728"}true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x730"}true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x738"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := zero_extend32_32(bvxor32(R8[32:0], R9[32:0])), (Gamma_R9 && Gamma_R8); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x748"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); R8, Gamma_R8 := zero_extend32_32(bvor32(R8[32:0], R9[32:0])), (Gamma_R9 && Gamma_R8); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x758"}true; R8, Gamma_R8 := 30bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x760"}true; R8, Gamma_R8 := 17bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x768"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); assert Gamma_R10; @@ -264,6 +274,7 @@ procedure main() NF, Gamma_NF := bvadd32(#5, 1bv32)[32:31], Gamma_#5; R8, Gamma_R8 := zero_extend32_32(bvadd32(#5, 1bv32)), Gamma_#5; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x780"}true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_operation_evaluation/clang_O2/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/clang_O2/basic_operation_evaluation.expected index 5f6aef7e1..863d7bd46 100644 --- a/src/test/correct/basic_operation_evaluation/clang_O2/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/clang_O2/basic_operation_evaluation.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1840bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1840bv64); +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -155,6 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_operation_evaluation/clang_no_plt_no_pic/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/clang_no_plt_no_pic/basic_operation_evaluation.expected index 74e693475..68868d22c 100644 --- a/src/test/correct/basic_operation_evaluation/clang_no_plt_no_pic/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/clang_no_plt_no_pic/basic_operation_evaluation.expected @@ -1,64 +1,64 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1952bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R10: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1952bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvmul"}bvmul64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot32(bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvor"}bvor32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvsdiv"}bvsdiv33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvxor"}bvxor32(bv32, bv32) returns (bv32); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -99,7 +99,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -108,12 +108,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_stack, R0, R10, R31, R8, R9, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -206,41 +206,51 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); + assume {:captureState "addr:0x720"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); + assume {:captureState "addr:0x728"}true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x730"}true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x738"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := zero_extend32_32(bvxor32(R8[32:0], R9[32:0])), (Gamma_R9 && Gamma_R8); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x748"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); R8, Gamma_R8 := zero_extend32_32(bvor32(R8[32:0], R9[32:0])), (Gamma_R9 && Gamma_R8); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x758"}true; R8, Gamma_R8 := 30bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x760"}true; R8, Gamma_R8 := 17bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x768"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); assert Gamma_R10; @@ -264,6 +274,7 @@ procedure main() NF, Gamma_NF := bvadd32(#5, 1bv32)[32:31], Gamma_#5; R8, Gamma_R8 := zero_extend32_32(bvadd32(#5, 1bv32)), Gamma_#5; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x780"}true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_operation_evaluation/clang_pic/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/clang_pic/basic_operation_evaluation.expected index 74e693475..68868d22c 100644 --- a/src/test/correct/basic_operation_evaluation/clang_pic/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/clang_pic/basic_operation_evaluation.expected @@ -1,64 +1,64 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1952bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R10: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1952bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvmul"}bvmul64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot32(bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvor"}bvor32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvsdiv"}bvsdiv33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvxor"}bvxor32(bv32, bv32) returns (bv32); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -99,7 +99,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -108,12 +108,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_stack, R0, R10, R31, R8, R9, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -206,41 +206,51 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); + assume {:captureState "addr:0x720"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); + assume {:captureState "addr:0x728"}true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x730"}true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x738"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := zero_extend32_32(bvxor32(R8[32:0], R9[32:0])), (Gamma_R9 && Gamma_R8); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x748"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); R8, Gamma_R8 := zero_extend32_32(bvor32(R8[32:0], R9[32:0])), (Gamma_R9 && Gamma_R8); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x758"}true; R8, Gamma_R8 := 30bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x760"}true; R8, Gamma_R8 := 17bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x768"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); assert Gamma_R10; @@ -264,6 +274,7 @@ procedure main() NF, Gamma_NF := bvadd32(#5, 1bv32)[32:31], Gamma_#5; R8, Gamma_R8 := zero_extend32_32(bvadd32(#5, 1bv32)), Gamma_#5; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x780"}true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_operation_evaluation/gcc/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/gcc/basic_operation_evaluation.expected index cce329b28..527e11509 100644 --- a/src/test/correct/basic_operation_evaluation/gcc/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/gcc/basic_operation_evaluation.expected @@ -1,56 +1,56 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1948bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1948bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvmul"}bvmul64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvnot"}bvnot32(bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvor"}bvor32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvsdiv"}bvsdiv33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvxor"}bvxor32(bv32, bv32) returns (bv32); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,7 +91,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,12 +100,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R31, Gamma_stack, R0, R1, R2, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -199,25 +199,34 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store64_le(stack, R31, R1), gamma_store64(Gamma_stack, R31, Gamma_R1); + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R0); + assume {:captureState "addr:0x724"}true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x72c"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R0, Gamma_R0 := zero_extend32_32(bvxor32(R1[32:0], R0[32:0])), (Gamma_R0 && Gamma_R1); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x73c"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := zero_extend32_32(bvor32(R1[32:0], R0[32:0])), (Gamma_R0 && Gamma_R1); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := 30bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R0); + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 17bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x75c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); assert Gamma_R1; @@ -236,6 +245,7 @@ procedure main() R1, Gamma_R1 := zero_extend32_32(bvmul64(zero_extend32_32(R2[32:0]), zero_extend32_32(R1[32:0]))[32:0]), (Gamma_R1 && Gamma_R2); R0, Gamma_R0 := zero_extend32_32(bvadd32(bvadd32(R0[32:0], bvnot32(R1[32:0])), 1bv32)), (Gamma_R1 && Gamma_R0); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_operation_evaluation/gcc_O2/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/gcc_O2/basic_operation_evaluation.expected index 2eddd390b..418f9a5da 100644 --- a/src/test/correct/basic_operation_evaluation/gcc_O2/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/gcc_O2/basic_operation_evaluation.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1896bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1896bv64); +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -155,6 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_operation_evaluation/gcc_no_plt_no_pic/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/gcc_no_plt_no_pic/basic_operation_evaluation.expected index a7b3105a5..0bfd7448d 100644 --- a/src/test/correct/basic_operation_evaluation/gcc_no_plt_no_pic/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/gcc_no_plt_no_pic/basic_operation_evaluation.expected @@ -1,56 +1,56 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1948bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1948bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvmul"}bvmul64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvnot"}bvnot32(bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvor"}bvor32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvsdiv"}bvsdiv33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvxor"}bvxor32(bv32, bv32) returns (bv32); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,7 +91,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,12 +100,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R31, Gamma_stack, R0, R1, R2, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -199,25 +199,34 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store64_le(stack, R31, R1), gamma_store64(Gamma_stack, R31, Gamma_R1); + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R0); + assume {:captureState "addr:0x724"}true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x72c"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R0, Gamma_R0 := zero_extend32_32(bvxor32(R1[32:0], R0[32:0])), (Gamma_R0 && Gamma_R1); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x73c"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := zero_extend32_32(bvor32(R1[32:0], R0[32:0])), (Gamma_R0 && Gamma_R1); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := 30bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R0); + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 17bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x75c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); assert Gamma_R1; @@ -236,6 +245,7 @@ procedure main() R1, Gamma_R1 := zero_extend32_32(bvmul64(zero_extend32_32(R2[32:0]), zero_extend32_32(R1[32:0]))[32:0]), (Gamma_R1 && Gamma_R2); R0, Gamma_R0 := zero_extend32_32(bvadd32(bvadd32(R0[32:0], bvnot32(R1[32:0])), 1bv32)), (Gamma_R1 && Gamma_R0); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_operation_evaluation/gcc_pic/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/gcc_pic/basic_operation_evaluation.expected index a7b3105a5..0bfd7448d 100644 --- a/src/test/correct/basic_operation_evaluation/gcc_pic/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/gcc_pic/basic_operation_evaluation.expected @@ -1,56 +1,56 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1948bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1948bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvmul"}bvmul64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvnot"}bvnot32(bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvor"}bvor32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvsdiv"}bvsdiv33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvxor"}bvxor32(bv32, bv32) returns (bv32); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,7 +91,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,12 +100,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R31, Gamma_stack, R0, R1, R2, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -199,25 +199,34 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store64_le(stack, R31, R1), gamma_store64(Gamma_stack, R31, Gamma_R1); + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R0); + assume {:captureState "addr:0x724"}true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x72c"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R0, Gamma_R0 := zero_extend32_32(bvxor32(R1[32:0], R0[32:0])), (Gamma_R0 && Gamma_R1); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x73c"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := zero_extend32_32(bvor32(R1[32:0], R0[32:0])), (Gamma_R0 && Gamma_R1); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := 30bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R0); + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 17bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x75c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); assert Gamma_R1; @@ -236,6 +245,7 @@ procedure main() R1, Gamma_R1 := zero_extend32_32(bvmul64(zero_extend32_32(R2[32:0]), zero_extend32_32(R1[32:0]))[32:0]), (Gamma_R1 && Gamma_R2); R0, Gamma_R0 := zero_extend32_32(bvadd32(bvadd32(R0[32:0], bvnot32(R1[32:0])), 1bv32)), (Gamma_R1 && Gamma_R0); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_read/clang/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/clang/basic_sec_policy_read.expected index 03ac930f1..5ccdb0df0 100644 --- a/src/test/correct/basic_sec_policy_read/clang/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/clang/basic_sec_policy_read.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -95,18 +95,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -199,23 +199,26 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); @@ -243,11 +246,15 @@ procedure main() } goto l0000035b; l0000035b: + assume {:captureState "addr:0x73c"}true; goto l0000035c; l0000035c: + assume {:captureState "addr:0x740"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); + assume {:captureState "addr:0x740"}true; goto l00000344; l00000344: + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_read/clang_O2/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/clang_O2/basic_sec_policy_read.expected index 29b3fc3a6..9254d1cf3 100644 --- a/src/test/correct/basic_sec_policy_read/clang_O2/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/clang_O2/basic_sec_policy_read.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -85,18 +85,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -187,17 +187,18 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); diff --git a/src/test/correct/basic_sec_policy_read/clang_no_plt_no_pic/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/clang_no_plt_no_pic/basic_sec_policy_read.expected index f69ff2e02..dd69ae193 100644 --- a/src/test/correct/basic_sec_policy_read/clang_no_plt_no_pic/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/clang_no_plt_no_pic/basic_sec_policy_read.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -95,18 +95,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -199,23 +199,26 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); @@ -243,11 +246,15 @@ procedure main() } goto l00000979; l00000979: + assume {:captureState "addr:0x73c"}true; goto l0000097a; l0000097a: + assume {:captureState "addr:0x740"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); + assume {:captureState "addr:0x740"}true; goto l00000962; l00000962: + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_read/clang_pic/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/clang_pic/basic_sec_policy_read.expected index 2d81bb360..89f602f16 100644 --- a/src/test/correct/basic_sec_policy_read/clang_pic/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/clang_pic/basic_sec_policy_read.expected @@ -1,60 +1,60 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -111,7 +111,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -119,18 +119,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -255,25 +255,28 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x758"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4040bv64)) || L(mem, bvadd64(R8, 4040bv64))); call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x768"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -303,11 +306,15 @@ procedure main() } goto l00000371; l00000371: + assume {:captureState "addr:0x784"}true; goto l00000372; l00000372: + assume {:captureState "addr:0x788"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); + assume {:captureState "addr:0x788"}true; goto l0000035a; l0000035a: + assume {:captureState "addr:0x790"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_read/gcc/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/gcc/basic_sec_policy_read.expected index 64e3b051f..8aaa1213b 100644 --- a/src/test/correct/basic_sec_policy_read/gcc/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/gcc/basic_sec_policy_read.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -93,18 +93,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -197,23 +197,25 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x724"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -229,9 +231,12 @@ procedure main() } goto l00000345; l00000345: + assume {:captureState "addr:0x73c"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x73c"}true; goto l0000032e; l0000032e: + assume {:captureState "addr:0x740"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_read/gcc_O2/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/gcc_O2/basic_sec_policy_read.expected index edc69990e..3ef4dd28b 100644 --- a/src/test/correct/basic_sec_policy_read/gcc_O2/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/gcc_O2/basic_sec_policy_read.expected @@ -1,36 +1,36 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69656bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69656bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -71,7 +71,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -79,18 +79,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -182,6 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; @@ -193,9 +194,11 @@ procedure main() } goto l0000039c; l0000039c: + assume {:captureState "addr:0x614"}true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R2, 4bv64))), (gamma_load32(Gamma_mem, bvadd64(R2, 4bv64)) || L(mem, bvadd64(R2, 4bv64))); goto l000001c2; l000001c2: + assume {:captureState "addr:0x618"}true; return; } diff --git a/src/test/correct/basic_sec_policy_read/gcc_no_plt_no_pic/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/gcc_no_plt_no_pic/basic_sec_policy_read.expected index 3d899e3ba..1e3b29dbd 100644 --- a/src/test/correct/basic_sec_policy_read/gcc_no_plt_no_pic/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/gcc_no_plt_no_pic/basic_sec_policy_read.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -93,18 +93,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -197,23 +197,25 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x724"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -229,9 +231,12 @@ procedure main() } goto l00000942; l00000942: + assume {:captureState "addr:0x73c"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x73c"}true; goto l0000092b; l0000092b: + assume {:captureState "addr:0x740"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_read/gcc_pic/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/gcc_pic/basic_sec_policy_read.expected index 7e9a3e0b7..e31b86ffc 100644 --- a/src/test/correct/basic_sec_policy_read/gcc_pic/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/gcc_pic/basic_sec_policy_read.expected @@ -1,58 +1,58 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -109,7 +109,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -117,18 +117,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_mem, Gamma_stack, R0, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -253,17 +253,18 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -271,6 +272,7 @@ procedure main() call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x764"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -287,9 +289,12 @@ procedure main() } goto l00000347; l00000347: + assume {:captureState "addr:0x77c"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x77c"}true; goto l00000330; l00000330: + assume {:captureState "addr:0x780"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_write/clang/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/clang/basic_sec_policy_write.expected index c9c7872e0..22367a2d9 100644 --- a/src/test/correct/basic_sec_policy_write/clang/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/clang/basic_sec_policy_write.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -91,18 +91,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -196,11 +196,13 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -210,6 +212,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x724"}true; R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R8, Gamma_R8 := 69632bv64, true; call rely(); @@ -219,6 +222,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), Gamma_R10); assert ((bvadd64(R8, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> true); @@ -227,6 +231,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); assert ((bvadd64(R8, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x738"}true; R8, Gamma_R8 := 2bv64, true; call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R8); @@ -235,6 +240,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x740"}true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_sec_policy_write/clang_O2/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/clang_O2/basic_sec_policy_write.expected index f5c73a175..f68544c6f 100644 --- a/src/test/correct/basic_sec_policy_write/clang_O2/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/clang_O2/basic_sec_policy_write.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -78,7 +78,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -86,18 +86,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R8, R9, mem; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -189,9 +189,10 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; @@ -203,6 +204,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); assert ((bvadd64(R8, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x724"}true; call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R10); z_old := memory_load32_le(mem, $z_addr); @@ -210,5 +212,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R10); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x728"}true; return; } diff --git a/src/test/correct/basic_sec_policy_write/clang_no_plt_no_pic/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/clang_no_plt_no_pic/basic_sec_policy_write.expected index c9c7872e0..22367a2d9 100644 --- a/src/test/correct/basic_sec_policy_write/clang_no_plt_no_pic/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/clang_no_plt_no_pic/basic_sec_policy_write.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -91,18 +91,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -196,11 +196,13 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -210,6 +212,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x724"}true; R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R8, Gamma_R8 := 69632bv64, true; call rely(); @@ -219,6 +222,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), Gamma_R10); assert ((bvadd64(R8, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> true); @@ -227,6 +231,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); assert ((bvadd64(R8, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x738"}true; R8, Gamma_R8 := 2bv64, true; call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R8); @@ -235,6 +240,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x740"}true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_sec_policy_write/clang_pic/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/clang_pic/basic_sec_policy_write.expected index d05390cf1..38704ec35 100644 --- a/src/test/correct/basic_sec_policy_write/clang_pic/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/clang_pic/basic_sec_policy_write.expected @@ -1,56 +1,56 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -107,7 +107,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -115,18 +115,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -252,11 +252,13 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x758"}true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4032bv64)) || L(mem, bvadd64(R9, 4032bv64))); @@ -268,6 +270,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert ((R9 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x768"}true; R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R8, Gamma_R8 := 65536bv64, true; call rely(); @@ -279,6 +282,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R8, R10[32:0]), gamma_store32(Gamma_mem, R8, Gamma_R10); assert ((R8 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, R8) ==> true); @@ -287,6 +291,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R8, 0bv32), gamma_store32(Gamma_mem, R8, true); assert ((R8 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x780"}true; R8, Gamma_R8 := 2bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); @@ -295,6 +300,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert ((R9 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x788"}true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_sec_policy_write/gcc/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/gcc/basic_sec_policy_write.expected index 44cdf43c0..f14dd2176 100644 --- a/src/test/correct/basic_sec_policy_write/gcc/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/gcc/basic_sec_policy_write.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -87,18 +87,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -192,11 +192,13 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -207,6 +209,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); @@ -217,6 +220,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -226,6 +230,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 2bv64, true; @@ -236,6 +241,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_write/gcc_O2/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/gcc_O2/basic_sec_policy_write.expected index 6a50e91d8..fabce9632 100644 --- a/src/test/correct/basic_sec_policy_write/gcc_O2/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/gcc_O2/basic_sec_policy_write.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R3: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R3: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R3: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }R3: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -78,7 +78,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -86,18 +86,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R3, Gamma_mem, R0, R1, R2, R3, mem; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -189,9 +189,10 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R3, Gamma_R3 := 2bv64, true; @@ -203,6 +204,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), true); assert ((bvadd64(R1, 20bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x610"}true; call rely(); assert (L(mem, bvadd64(R2, 4bv64)) ==> Gamma_R3); z_old := memory_load32_le(mem, $z_addr); @@ -210,5 +212,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R2, 4bv64), R3[32:0]), gamma_store32(Gamma_mem, bvadd64(R2, 4bv64), Gamma_R3); assert ((bvadd64(R2, 4bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x614"}true; return; } diff --git a/src/test/correct/basic_sec_policy_write/gcc_no_plt_no_pic/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/gcc_no_plt_no_pic/basic_sec_policy_write.expected index 44cdf43c0..f14dd2176 100644 --- a/src/test/correct/basic_sec_policy_write/gcc_no_plt_no_pic/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/gcc_no_plt_no_pic/basic_sec_policy_write.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -87,18 +87,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -192,11 +192,13 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -207,6 +209,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); @@ -217,6 +220,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -226,6 +230,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 2bv64, true; @@ -236,6 +241,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_write/gcc_pic/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/gcc_pic/basic_sec_policy_write.expected index 79e7ed95c..c9e53cb63 100644 --- a/src/test/correct/basic_sec_policy_write/gcc_pic/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/gcc_pic/basic_sec_policy_write.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -103,7 +103,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -111,18 +111,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; requires (Gamma_R0 == false); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -248,11 +248,13 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x758"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -264,6 +266,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -275,6 +278,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -285,6 +289,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x784"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -296,6 +301,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); + assume {:captureState "addr:0x794"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basicassign_gamma0/clang/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/clang/basicassign_gamma0.expected index 6b52453e1..4a6b81ff1 100644 --- a/src/test/correct/basicassign_gamma0/clang/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/clang/basicassign_gamma0.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69684bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69684bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -85,15 +85,15 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (gamma_load32(Gamma_mem, $secret_addr) == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -186,6 +186,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -193,6 +194,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basicassign_gamma0/clang_O2/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/clang_O2/basicassign_gamma0.expected index 3b4a59dd8..a3d5ee86d 100644 --- a/src/test/correct/basicassign_gamma0/clang_O2/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/clang_O2/basicassign_gamma0.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69684bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69684bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -85,15 +85,15 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (gamma_load32(Gamma_mem, $secret_addr) == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -186,6 +186,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -194,5 +195,6 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; return; } diff --git a/src/test/correct/basicassign_gamma0/clang_no_plt_no_pic/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/clang_no_plt_no_pic/basicassign_gamma0.expected index 6b52453e1..4a6b81ff1 100644 --- a/src/test/correct/basicassign_gamma0/clang_no_plt_no_pic/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/clang_no_plt_no_pic/basicassign_gamma0.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69684bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69684bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -85,15 +85,15 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (gamma_load32(Gamma_mem, $secret_addr) == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -186,6 +186,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -193,6 +194,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basicassign_gamma0/clang_pic/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/clang_pic/basicassign_gamma0.expected index 2e697517a..8d3b6f254 100644 --- a/src/test/correct/basicassign_gamma0/clang_pic/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/clang_pic/basicassign_gamma0.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69684bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69684bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -101,7 +101,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -109,15 +109,15 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires (gamma_load32(Gamma_mem, $secret_addr) == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -242,6 +242,7 @@ procedure main() free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x754"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4048bv64)) || L(mem, bvadd64(R8, 4048bv64))); @@ -253,6 +254,7 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basicassign_gamma0/gcc/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/gcc/basicassign_gamma0.expected index 9c0a66786..eb4fdf55d 100644 --- a/src/test/correct/basicassign_gamma0/gcc/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/gcc/basicassign_gamma0.expected @@ -1,40 +1,40 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69656bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69656bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -75,7 +75,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -83,15 +83,15 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (gamma_load32(Gamma_mem, $secret_addr) == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -184,6 +184,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -193,6 +194,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basicassign_gamma0/gcc_O2/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/gcc_O2/basicassign_gamma0.expected index 4e28b6f94..d1e5aa131 100644 --- a/src/test/correct/basicassign_gamma0/gcc_O2/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/gcc_O2/basicassign_gamma0.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69656bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69656bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -85,15 +85,15 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; requires (gamma_load32(Gamma_mem, $secret_addr) == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -186,6 +186,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; @@ -194,5 +195,6 @@ procedure main() call rely(); assert (L(mem, bvadd64(R1, 20bv64)) ==> Gamma_R2); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R2); + assume {:captureState "addr:0x610"}true; return; } diff --git a/src/test/correct/basicassign_gamma0/gcc_no_plt_no_pic/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/gcc_no_plt_no_pic/basicassign_gamma0.expected index 9c0a66786..eb4fdf55d 100644 --- a/src/test/correct/basicassign_gamma0/gcc_no_plt_no_pic/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/gcc_no_plt_no_pic/basicassign_gamma0.expected @@ -1,40 +1,40 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69656bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69656bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -75,7 +75,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -83,15 +83,15 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (gamma_load32(Gamma_mem, $secret_addr) == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -184,6 +184,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -193,6 +194,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basicassign_gamma0/gcc_pic/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/gcc_pic/basicassign_gamma0.expected index 474c43ba6..d09ef1c76 100644 --- a/src/test/correct/basicassign_gamma0/gcc_pic/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/gcc_pic/basicassign_gamma0.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69656bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69656bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -99,7 +99,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -107,15 +107,15 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (gamma_load32(Gamma_mem, $secret_addr) == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -240,6 +240,7 @@ procedure main() free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -251,6 +252,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basicfree/clang/basicfree.expected b/src/test/correct/basicfree/clang/basicfree.expected index a746e3ad3..1de1ece3a 100644 --- a/src/test/correct/basicfree/clang/basicfree.expected +++ b/src/test/correct/basicfree/clang/basicfree.expected @@ -1,59 +1,59 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2080bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2080bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,12 +103,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2080bv64) == 1bv8); free requires (memory_load8_le(mem, 2081bv64) == 0bv8); @@ -183,7 +183,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69680bv64) == 0bv8); free requires (memory_load8_le(mem, 69681bv64) == 0bv8); @@ -278,32 +278,39 @@ procedure main() free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: + assume {:captureState "addr:0x7d4"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x7d8"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x7d8"}true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2024bv64, true; call malloc(); goto l0000030d; l0000030d: + assume {:captureState "addr:0x7e8"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x7e8"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 1bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x7f4"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2048bv64, true; call #free(); goto l00000338; l00000338: + assume {:captureState "addr:0x800"}true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(#5, 8bv64)), gamma_load64(Gamma_stack, bvadd64(#5, 8bv64)); @@ -311,7 +318,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2080bv64) == 1bv8); free requires (memory_load8_le(mem, 2081bv64) == 0bv8); diff --git a/src/test/correct/basicfree/clang_O2/basicfree.expected b/src/test/correct/basicfree/clang_O2/basicfree.expected index 91a00d7c9..6ca38a2b2 100644 --- a/src/test/correct/basicfree/clang_O2/basicfree.expected +++ b/src/test/correct/basicfree/clang_O2/basicfree.expected @@ -1,12 +1,12 @@ -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1836bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }mem: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1836bv64); +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -47,7 +47,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,12 +56,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); free requires (memory_load8_le(mem, 69666bv64) == 0bv8); @@ -152,5 +152,6 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; return; } diff --git a/src/test/correct/basicfree/clang_no_plt_no_pic/basicfree.expected b/src/test/correct/basicfree/clang_no_plt_no_pic/basicfree.expected index d72c83d9e..4e90916c5 100644 --- a/src/test/correct/basicfree/clang_no_plt_no_pic/basicfree.expected +++ b/src/test/correct/basicfree/clang_no_plt_no_pic/basicfree.expected @@ -1,59 +1,59 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2080bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2080bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,12 +103,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2080bv64) == 1bv8); free requires (memory_load8_le(mem, 2081bv64) == 0bv8); @@ -183,7 +183,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69680bv64) == 0bv8); free requires (memory_load8_le(mem, 69681bv64) == 0bv8); @@ -278,32 +278,39 @@ procedure main() free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: + assume {:captureState "addr:0x7d4"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x7d8"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x7d8"}true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2024bv64, true; call malloc(); goto l000008ed; l000008ed: + assume {:captureState "addr:0x7e8"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x7e8"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 1bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x7f4"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2048bv64, true; call #free(); goto l00000918; l00000918: + assume {:captureState "addr:0x800"}true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(#5, 8bv64)), gamma_load64(Gamma_stack, bvadd64(#5, 8bv64)); @@ -311,7 +318,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2080bv64) == 1bv8); free requires (memory_load8_le(mem, 2081bv64) == 0bv8); diff --git a/src/test/correct/basicfree/clang_pic/basicfree.expected b/src/test/correct/basicfree/clang_pic/basicfree.expected index d72c83d9e..4e90916c5 100644 --- a/src/test/correct/basicfree/clang_pic/basicfree.expected +++ b/src/test/correct/basicfree/clang_pic/basicfree.expected @@ -1,59 +1,59 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2080bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2080bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,12 +103,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2080bv64) == 1bv8); free requires (memory_load8_le(mem, 2081bv64) == 0bv8); @@ -183,7 +183,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69680bv64) == 0bv8); free requires (memory_load8_le(mem, 69681bv64) == 0bv8); @@ -278,32 +278,39 @@ procedure main() free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: + assume {:captureState "addr:0x7d4"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x7d8"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x7d8"}true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2024bv64, true; call malloc(); goto l000008ed; l000008ed: + assume {:captureState "addr:0x7e8"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x7e8"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 1bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x7f4"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2048bv64, true; call #free(); goto l00000918; l00000918: + assume {:captureState "addr:0x800"}true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(#5, 8bv64)), gamma_load64(Gamma_stack, bvadd64(#5, 8bv64)); @@ -311,7 +318,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2080bv64) == 1bv8); free requires (memory_load8_le(mem, 2081bv64) == 0bv8); diff --git a/src/test/correct/basicfree/gcc/basicfree.expected b/src/test/correct/basicfree/gcc/basicfree.expected index 40e612597..1ed12b672 100644 --- a/src/test/correct/basicfree/gcc/basicfree.expected +++ b/src/test/correct/basicfree/gcc/basicfree.expected @@ -1,57 +1,57 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2076bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2076bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,12 +101,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2076bv64) == 1bv8); free requires (memory_load8_le(mem, 2077bv64) == 0bv8); @@ -181,7 +181,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -276,12 +276,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x7d4"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x7d4"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x7d4"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 4bv64, true; @@ -289,24 +292,28 @@ procedure main() call malloc(); goto l00000307; l00000307: + assume {:captureState "addr:0x7e4"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x7e4"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R1, Gamma_R1 := 1bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x7f0"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 2044bv64, true; call #free(); goto l00000332; l00000332: + assume {:captureState "addr:0x7fc"}true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2076bv64) == 1bv8); free requires (memory_load8_le(mem, 2077bv64) == 0bv8); diff --git a/src/test/correct/basicfree/gcc_O2/basicfree.expected b/src/test/correct/basicfree/gcc_O2/basicfree.expected index db9ab2b08..cf806e8fd 100644 --- a/src/test/correct/basicfree/gcc_O2/basicfree.expected +++ b/src/test/correct/basicfree/gcc_O2/basicfree.expected @@ -1,12 +1,12 @@ -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1896bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }mem: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1896bv64); +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -47,7 +47,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,12 +56,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); free requires (memory_load8_le(mem, 69634bv64) == 0bv8); @@ -152,5 +152,6 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; return; } diff --git a/src/test/correct/basicfree/gcc_no_plt_no_pic/basicfree.expected b/src/test/correct/basicfree/gcc_no_plt_no_pic/basicfree.expected index 2320876e3..220da675a 100644 --- a/src/test/correct/basicfree/gcc_no_plt_no_pic/basicfree.expected +++ b/src/test/correct/basicfree/gcc_no_plt_no_pic/basicfree.expected @@ -1,57 +1,57 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2076bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2076bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,12 +101,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2076bv64) == 1bv8); free requires (memory_load8_le(mem, 2077bv64) == 0bv8); @@ -181,7 +181,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -276,12 +276,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x7d4"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x7d4"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x7d4"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 4bv64, true; @@ -289,24 +292,28 @@ procedure main() call malloc(); goto l000008dc; l000008dc: + assume {:captureState "addr:0x7e4"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x7e4"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R1, Gamma_R1 := 1bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x7f0"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 2044bv64, true; call #free(); goto l00000907; l00000907: + assume {:captureState "addr:0x7fc"}true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2076bv64) == 1bv8); free requires (memory_load8_le(mem, 2077bv64) == 0bv8); diff --git a/src/test/correct/basicfree/gcc_pic/basicfree.expected b/src/test/correct/basicfree/gcc_pic/basicfree.expected index 2320876e3..220da675a 100644 --- a/src/test/correct/basicfree/gcc_pic/basicfree.expected +++ b/src/test/correct/basicfree/gcc_pic/basicfree.expected @@ -1,57 +1,57 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2076bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2076bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,12 +101,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2076bv64) == 1bv8); free requires (memory_load8_le(mem, 2077bv64) == 0bv8); @@ -181,7 +181,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -276,12 +276,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x7d4"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x7d4"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x7d4"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 4bv64, true; @@ -289,24 +292,28 @@ procedure main() call malloc(); goto l000008dc; l000008dc: + assume {:captureState "addr:0x7e4"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x7e4"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R1, Gamma_R1 := 1bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x7f0"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 2044bv64, true; call #free(); goto l00000907; l00000907: + assume {:captureState "addr:0x7fc"}true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2076bv64) == 1bv8); free requires (memory_load8_le(mem, 2077bv64) == 0bv8); diff --git a/src/test/correct/cjump/clang/cjump.expected b/src/test/correct/cjump/clang/cjump.expected index a9b2d44e6..03f893ccf 100644 --- a/src/test/correct/cjump/clang/cjump.expected +++ b/src/test/correct/cjump/clang/cjump.expected @@ -1,54 +1,54 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,12 +98,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == false); @@ -198,24 +198,27 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); + assume {:captureState "addr:0x724"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; @@ -242,22 +245,28 @@ procedure main() } goto l0000037e; l00000351: + assume {:captureState "addr:0x74c"}true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 2bv64, true; call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); + assume {:captureState "addr:0x754"}true; goto l00000369; l0000037e: + assume {:captureState "addr:0x738"}true; goto l0000037f; l0000037f: + assume {:captureState "addr:0x73c"}true; R8, Gamma_R8 := 3bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); + assume {:captureState "addr:0x744"}true; goto l00000369; l00000369: + assume {:captureState "addr:0x75c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/cjump/clang_O2/cjump.expected b/src/test/correct/cjump/clang_O2/cjump.expected index 17c5bc302..b975a33e5 100644 --- a/src/test/correct/cjump/clang_O2/cjump.expected +++ b/src/test/correct/cjump/clang_O2/cjump.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R11: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R11: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R11: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R11: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,12 +85,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R11, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R11, R8, R9, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == false); @@ -184,6 +184,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; @@ -192,8 +193,10 @@ procedure main() call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); + assume {:captureState "addr:0x728"}true; call rely(); assert (L(mem, bvadd64(R10, 56bv64)) ==> Gamma_R11); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R10, 56bv64), R11[32:0]), gamma_store32(Gamma_mem, bvadd64(R10, 56bv64), Gamma_R11); + assume {:captureState "addr:0x72c"}true; return; } diff --git a/src/test/correct/cjump/clang_no_plt_no_pic/cjump.expected b/src/test/correct/cjump/clang_no_plt_no_pic/cjump.expected index 6a74e6739..0ab319383 100644 --- a/src/test/correct/cjump/clang_no_plt_no_pic/cjump.expected +++ b/src/test/correct/cjump/clang_no_plt_no_pic/cjump.expected @@ -1,54 +1,54 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,12 +98,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == false); @@ -198,24 +198,27 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); + assume {:captureState "addr:0x724"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; @@ -242,22 +245,28 @@ procedure main() } goto l000009d4; l000009a7: + assume {:captureState "addr:0x74c"}true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 2bv64, true; call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); + assume {:captureState "addr:0x754"}true; goto l000009bf; l000009d4: + assume {:captureState "addr:0x738"}true; goto l000009d5; l000009d5: + assume {:captureState "addr:0x73c"}true; R8, Gamma_R8 := 3bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); + assume {:captureState "addr:0x744"}true; goto l000009bf; l000009bf: + assume {:captureState "addr:0x75c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/cjump/clang_pic/cjump.expected b/src/test/correct/cjump/clang_pic/cjump.expected index 2cecafe8a..37fb79cb2 100644 --- a/src/test/correct/cjump/clang_pic/cjump.expected +++ b/src/test/correct/cjump/clang_pic/cjump.expected @@ -1,62 +1,62 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -113,7 +113,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -122,12 +122,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == false); @@ -254,19 +254,21 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x758"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -274,6 +276,7 @@ procedure main() call rely(); assert (L(mem, R8) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, R8, R9[32:0]), gamma_store32(Gamma_mem, R8, Gamma_R9); + assume {:captureState "addr:0x768"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; @@ -300,6 +303,7 @@ procedure main() } goto l00000398; l00000364: + assume {:captureState "addr:0x794"}true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4048bv64)) || L(mem, bvadd64(R9, 4048bv64))); @@ -307,10 +311,13 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x7a0"}true; goto l00000383; l00000398: + assume {:captureState "addr:0x77c"}true; goto l00000399; l00000399: + assume {:captureState "addr:0x780"}true; R8, Gamma_R8 := 3bv64, true; R9, Gamma_R9 := 65536bv64, true; call rely(); @@ -318,8 +325,10 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x78c"}true; goto l00000383; l00000383: + assume {:captureState "addr:0x7a8"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/cjump/gcc/cjump.expected b/src/test/correct/cjump/gcc/cjump.expected index 316087ea1..8944ce29e 100644 --- a/src/test/correct/cjump/gcc/cjump.expected +++ b/src/test/correct/cjump/gcc/cjump.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,12 +92,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == false); @@ -190,23 +190,25 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -222,22 +224,27 @@ procedure main() } goto l00000365; l0000033e: + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 2bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x758"}true; goto l0000035b; l00000365: + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 3bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x744"}true; goto l0000035b; l0000035b: + assume {:captureState "addr:0x75c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/cjump/gcc_O2/cjump.expected b/src/test/correct/cjump/gcc_O2/cjump.expected index 6a9e8da8f..d28e04d56 100644 --- a/src/test/correct/cjump/gcc_O2/cjump.expected +++ b/src/test/correct/cjump/gcc_O2/cjump.expected @@ -1,39 +1,39 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R3: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R3: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R3: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }R3: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -74,7 +74,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,12 +83,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R3, Gamma_mem, R0, R1, R2, R3, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == false); @@ -182,6 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; R0, Gamma_R0 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R0, 20bv64), Gamma_R0; R3, Gamma_R3 := 1bv64, true; @@ -189,9 +190,11 @@ procedure main() call rely(); assert (L(mem, bvadd64(R0, 20bv64)) ==> Gamma_R3); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R0, 20bv64), R3[32:0]), gamma_store32(Gamma_mem, bvadd64(R0, 20bv64), Gamma_R3); + assume {:captureState "addr:0x610"}true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R1, 4bv64)) ==> Gamma_R2); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 4bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 4bv64), Gamma_R2); + assume {:captureState "addr:0x618"}true; return; } diff --git a/src/test/correct/cjump/gcc_no_plt_no_pic/cjump.expected b/src/test/correct/cjump/gcc_no_plt_no_pic/cjump.expected index ef72c2e18..34a1bd1d7 100644 --- a/src/test/correct/cjump/gcc_no_plt_no_pic/cjump.expected +++ b/src/test/correct/cjump/gcc_no_plt_no_pic/cjump.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,12 +92,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == false); @@ -190,23 +190,25 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -222,22 +224,27 @@ procedure main() } goto l000009a3; l0000097c: + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 2bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x758"}true; goto l00000999; l000009a3: + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 3bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x744"}true; goto l00000999; l00000999: + assume {:captureState "addr:0x75c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/cjump/gcc_pic/cjump.expected b/src/test/correct/cjump/gcc_pic/cjump.expected index 0c0297b3a..63ccf118d 100644 --- a/src/test/correct/cjump/gcc_pic/cjump.expected +++ b/src/test/correct/cjump/gcc_pic/cjump.expected @@ -1,56 +1,56 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -107,7 +107,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -116,12 +116,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == false); @@ -246,17 +246,18 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -264,6 +265,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -280,6 +282,7 @@ procedure main() } goto l00000368; l00000340: + assume {:captureState "addr:0x78c"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -287,8 +290,10 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x798"}true; goto l0000035e; l00000368: + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -296,8 +301,10 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x784"}true; goto l0000035e; l0000035e: + assume {:captureState "addr:0x79c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/function/clang/function.expected b/src/test/correct/function/clang/function.expected index 1d34f0bb2..afdf8432e 100644 --- a/src/test/correct/function/clang/function.expected +++ b/src/test/correct/function/clang/function.expected @@ -1,61 +1,61 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,7 +96,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -105,12 +105,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1884bv64) == 1bv8); free requires (memory_load8_le(mem, 1885bv64) == 0bv8); @@ -187,11 +187,12 @@ procedure get_two() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lget_two: + assume {:captureState "addr:0x740"}true; R0, Gamma_R0 := 2bv64, true; return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R29, R30, R31, R8, R9, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == true); @@ -288,12 +289,15 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x714"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x714"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R9, Gamma_R9 := 69632bv64, true; @@ -301,14 +305,17 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; R30, Gamma_R30 := 1836bv64, true; call get_two(); goto l00000910; l00000910: + assume {:captureState "addr:0x72c"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), Gamma_R0); + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function/clang_O2/function.expected b/src/test/correct/function/clang_O2/function.expected index 43deb54a7..139696a65 100644 --- a/src/test/correct/function/clang_O2/function.expected +++ b/src/test/correct/function/clang_O2/function.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R11: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R11: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R11: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R11: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,12 +85,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R11, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R11, R8, R9, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == true); @@ -184,6 +184,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; @@ -192,8 +193,10 @@ procedure main() call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); + assume {:captureState "addr:0x728"}true; call rely(); assert (L(mem, bvadd64(R10, 56bv64)) ==> Gamma_R11); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R10, 56bv64), R11[32:0]), gamma_store32(Gamma_mem, bvadd64(R10, 56bv64), Gamma_R11); + assume {:captureState "addr:0x72c"}true; return; } diff --git a/src/test/correct/function/clang_no_plt_no_pic/function.expected b/src/test/correct/function/clang_no_plt_no_pic/function.expected index 1d34f0bb2..afdf8432e 100644 --- a/src/test/correct/function/clang_no_plt_no_pic/function.expected +++ b/src/test/correct/function/clang_no_plt_no_pic/function.expected @@ -1,61 +1,61 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,7 +96,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -105,12 +105,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1884bv64) == 1bv8); free requires (memory_load8_le(mem, 1885bv64) == 0bv8); @@ -187,11 +187,12 @@ procedure get_two() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lget_two: + assume {:captureState "addr:0x740"}true; R0, Gamma_R0 := 2bv64, true; return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R29, R30, R31, R8, R9, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == true); @@ -288,12 +289,15 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x714"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x714"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R9, Gamma_R9 := 69632bv64, true; @@ -301,14 +305,17 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; R30, Gamma_R30 := 1836bv64, true; call get_two(); goto l00000910; l00000910: + assume {:captureState "addr:0x72c"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), Gamma_R0); + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function/clang_pic/function.expected b/src/test/correct/function/clang_pic/function.expected index 54d1bb9de..15b648d0a 100644 --- a/src/test/correct/function/clang_pic/function.expected +++ b/src/test/correct/function/clang_pic/function.expected @@ -1,61 +1,61 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -112,7 +112,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -121,12 +121,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1956bv64) == 1bv8); free requires (memory_load8_le(mem, 1957bv64) == 0bv8); @@ -235,11 +235,12 @@ procedure get_two() free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { lget_two: + assume {:captureState "addr:0x788"}true; R0, Gamma_R0 := 2bv64, true; return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R29, R30, R31, R8, R9, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == true); @@ -368,12 +369,15 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x754"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x754"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R9, Gamma_R9 := 65536bv64, true; @@ -383,16 +387,19 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x768"}true; R30, Gamma_R30 := 1904bv64, true; call get_two(); goto l0000032c; l0000032c: + assume {:captureState "addr:0x770"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4048bv64)) || L(mem, bvadd64(R8, 4048bv64))); call rely(); assert (L(mem, R8) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, R8, R0[32:0]), gamma_store32(Gamma_mem, R8, Gamma_R0); + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function/gcc/function.expected b/src/test/correct/function/gcc/function.expected index 8916c1618..951db16a2 100644 --- a/src/test/correct/function/gcc/function.expected +++ b/src/test/correct/function/gcc/function.expected @@ -1,60 +1,60 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -95,7 +95,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -104,12 +104,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1896bv64) == 1bv8); free requires (memory_load8_le(mem, 1897bv64) == 0bv8); @@ -186,11 +186,12 @@ procedure get_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lget_two: + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := 2bv64, true; return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == true); @@ -287,12 +288,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x714"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x714"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 69632bv64, true; @@ -301,16 +305,19 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x728"}true; R30, Gamma_R30 := 1840bv64, true; call get_two(); goto l00000946; l00000946: + assume {:captureState "addr:0x730"}true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x73c"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function/gcc_O2/function.expected b/src/test/correct/function/gcc_O2/function.expected index 7e43c3063..e26bc9c95 100644 --- a/src/test/correct/function/gcc_O2/function.expected +++ b/src/test/correct/function/gcc_O2/function.expected @@ -1,39 +1,39 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R3: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R3: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R3: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }R3: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -74,7 +74,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,12 +83,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R3, Gamma_mem, R0, R1, R2, R3, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == true); @@ -182,6 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; R0, Gamma_R0 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R0, 20bv64), Gamma_R0; R3, Gamma_R3 := 1bv64, true; @@ -189,9 +190,11 @@ procedure main() call rely(); assert (L(mem, bvadd64(R0, 20bv64)) ==> Gamma_R3); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R0, 20bv64), R3[32:0]), gamma_store32(Gamma_mem, bvadd64(R0, 20bv64), Gamma_R3); + assume {:captureState "addr:0x610"}true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R1, 4bv64)) ==> Gamma_R2); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 4bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 4bv64), Gamma_R2); + assume {:captureState "addr:0x618"}true; return; } diff --git a/src/test/correct/function/gcc_no_plt_no_pic/function.expected b/src/test/correct/function/gcc_no_plt_no_pic/function.expected index 8916c1618..951db16a2 100644 --- a/src/test/correct/function/gcc_no_plt_no_pic/function.expected +++ b/src/test/correct/function/gcc_no_plt_no_pic/function.expected @@ -1,60 +1,60 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -95,7 +95,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -104,12 +104,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1896bv64) == 1bv8); free requires (memory_load8_le(mem, 1897bv64) == 0bv8); @@ -186,11 +186,12 @@ procedure get_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lget_two: + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := 2bv64, true; return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == true); @@ -287,12 +288,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x714"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x714"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 69632bv64, true; @@ -301,16 +305,19 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x728"}true; R30, Gamma_R30 := 1840bv64, true; call get_two(); goto l00000946; l00000946: + assume {:captureState "addr:0x730"}true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x73c"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function/gcc_pic/function.expected b/src/test/correct/function/gcc_pic/function.expected index f7c0f43c3..b3b5058bf 100644 --- a/src/test/correct/function/gcc_pic/function.expected +++ b/src/test/correct/function/gcc_pic/function.expected @@ -1,60 +1,60 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -111,7 +111,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -120,12 +120,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 1960bv64) == 1bv8); free requires (memory_load8_le(mem, 1961bv64) == 0bv8); @@ -234,11 +234,12 @@ procedure get_two() free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { lget_two: + assume {:captureState "addr:0x78c"}true; R0, Gamma_R0 := 2bv64, true; return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $y_addr) == true); @@ -367,12 +368,15 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x754"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x754"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 65536bv64, true; @@ -382,10 +386,12 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x768"}true; R30, Gamma_R30 := 1904bv64, true; call get_two(); goto l00000330; l00000330: + assume {:captureState "addr:0x770"}true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -393,6 +399,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x77c"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function1/clang/function1.expected b/src/test/correct/function1/clang/function1.expected index 323914599..0c2443f8d 100644 --- a/src/test/correct/function1/clang/function1.expected +++ b/src/test/correct/function1/clang/function1.expected @@ -1,91 +1,91 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2024bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69692bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69696bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R2: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2024bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69692bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69696bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "sign_extend 32"} sign_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 32"}sign_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -130,7 +130,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -139,12 +139,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_stack, R0, R31, R8, R9, stack; free requires (memory_load8_le(mem, 2024bv64) == 1bv8); free requires (memory_load8_le(mem, 2025bv64) == 0bv8); @@ -230,10 +230,14 @@ procedure get_two() free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { lget_two: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); + assume {:captureState "addr:0x758"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R1[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R1); + assume {:captureState "addr:0x75c"}true; stack, Gamma_stack := memory_store64_le(stack, R31, R2), gamma_store64(Gamma_stack, R31, Gamma_R2); + assume {:captureState "addr:0x760"}true; R8, Gamma_R8 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R9, Gamma_R9 := zero_extend32_32(bvadd32(R8[32:0], R9[32:0])), (Gamma_R9 && Gamma_R8); @@ -244,7 +248,7 @@ procedure get_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R2, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -347,12 +351,15 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x784"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x784"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x784"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R9, Gamma_R9 := 69632bv64, true; @@ -360,6 +367,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 60bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 60bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 60bv64), Gamma_R8); + assume {:captureState "addr:0x794"}true; R0, Gamma_R0 := 97bv64, true; R1, Gamma_R1 := 10bv64, true; R2, Gamma_R2 := 58368bv64, true; @@ -369,10 +377,12 @@ procedure main() call get_two(); goto l000003ce; l000003ce: + assume {:captureState "addr:0x7b0"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 64bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 64bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 64bv64), Gamma_R0); + assume {:captureState "addr:0x7b4"}true; call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 64bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 64bv64)) || L(mem, bvadd64(R8, 64bv64))); R0, Gamma_R0 := 0bv64, true; @@ -381,6 +391,7 @@ procedure main() call printf(); goto l000003f5; l000003f5: + assume {:captureState "addr:0x7c8"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -388,7 +399,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2024bv64) == 1bv8); free requires (memory_load8_le(mem, 2025bv64) == 0bv8); diff --git a/src/test/correct/function1/clang_O2/function1.expected b/src/test/correct/function1/clang_O2/function1.expected index 21ae07234..4bc9567ef 100644 --- a/src/test/correct/function1/clang_O2/function1.expected +++ b/src/test/correct/function1/clang_O2/function1.expected @@ -1,70 +1,70 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R11: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R10: bv64; -var {:extern } R11: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1976bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69692bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69696bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R11: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R10: bv64; +var {:extern }R11: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1976bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69692bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69696bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,7 +109,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -118,12 +118,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R10, Gamma_R11, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R10, R11, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -226,12 +226,15 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x760"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x760"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x760"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R11, Gamma_R11 := 58475bv64, true; @@ -246,13 +249,16 @@ procedure main() call rely(); assert (L(mem, bvadd64(R8, 60bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 60bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 60bv64), Gamma_R9); + assume {:captureState "addr:0x78c"}true; call rely(); assert (L(mem, bvadd64(R10, 64bv64)) ==> Gamma_R11); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R10, 64bv64), R11[32:0]), gamma_store32(Gamma_mem, bvadd64(R10, 64bv64), Gamma_R11); + assume {:captureState "addr:0x790"}true; R30, Gamma_R30 := 1944bv64, true; call printf(); goto l00000371; l00000371: + assume {:captureState "addr:0x798"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -260,7 +266,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1976bv64) == 1bv8); free requires (memory_load8_le(mem, 1977bv64) == 0bv8); diff --git a/src/test/correct/function1/clang_no_plt_no_pic/function1.expected b/src/test/correct/function1/clang_no_plt_no_pic/function1.expected index dc22a11ee..c3e2bcfc6 100644 --- a/src/test/correct/function1/clang_no_plt_no_pic/function1.expected +++ b/src/test/correct/function1/clang_no_plt_no_pic/function1.expected @@ -1,91 +1,91 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2024bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69692bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69696bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R2: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2024bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69692bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69696bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "sign_extend 32"} sign_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 32"}sign_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -130,7 +130,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -139,12 +139,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_stack, R0, R31, R8, R9, stack; free requires (memory_load8_le(mem, 2024bv64) == 1bv8); free requires (memory_load8_le(mem, 2025bv64) == 0bv8); @@ -230,10 +230,14 @@ procedure get_two() free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { lget_two: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); + assume {:captureState "addr:0x758"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R1[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R1); + assume {:captureState "addr:0x75c"}true; stack, Gamma_stack := memory_store64_le(stack, R31, R2), gamma_store64(Gamma_stack, R31, Gamma_R2); + assume {:captureState "addr:0x760"}true; R8, Gamma_R8 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R9, Gamma_R9 := zero_extend32_32(bvadd32(R8[32:0], R9[32:0])), (Gamma_R9 && Gamma_R8); @@ -244,7 +248,7 @@ procedure get_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R2, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -347,12 +351,15 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x784"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x784"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x784"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R9, Gamma_R9 := 69632bv64, true; @@ -360,6 +367,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 60bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 60bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 60bv64), Gamma_R8); + assume {:captureState "addr:0x794"}true; R0, Gamma_R0 := 97bv64, true; R1, Gamma_R1 := 10bv64, true; R2, Gamma_R2 := 58368bv64, true; @@ -369,10 +377,12 @@ procedure main() call get_two(); goto l00000adf; l00000adf: + assume {:captureState "addr:0x7b0"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 64bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 64bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 64bv64), Gamma_R0); + assume {:captureState "addr:0x7b4"}true; call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 64bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 64bv64)) || L(mem, bvadd64(R8, 64bv64))); R0, Gamma_R0 := 0bv64, true; @@ -381,6 +391,7 @@ procedure main() call printf(); goto l00000b06; l00000b06: + assume {:captureState "addr:0x7c8"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -388,7 +399,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2024bv64) == 1bv8); free requires (memory_load8_le(mem, 2025bv64) == 0bv8); diff --git a/src/test/correct/function1/clang_pic/function1.expected b/src/test/correct/function1/clang_pic/function1.expected index 7772d879f..2b0501aad 100644 --- a/src/test/correct/function1/clang_pic/function1.expected +++ b/src/test/correct/function1/clang_pic/function1.expected @@ -1,91 +1,91 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2096bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69692bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69696bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R2: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2096bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69692bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69696bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "sign_extend 32"} sign_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 32"}sign_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -146,7 +146,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69590bv64) == 0bv8); free ensures (memory_load8_le(mem, 69591bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -155,12 +155,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_stack, R0, R31, R8, R9, stack; free requires (memory_load8_le(mem, 2096bv64) == 1bv8); free requires (memory_load8_le(mem, 2097bv64) == 0bv8); @@ -278,10 +278,14 @@ procedure get_two() free ensures (memory_load8_le(mem, 69591bv64) == 0bv8); { lget_two: + assume {:captureState "addr:0x794"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); + assume {:captureState "addr:0x798"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R1[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R1); + assume {:captureState "addr:0x79c"}true; stack, Gamma_stack := memory_store64_le(stack, R31, R2), gamma_store64(Gamma_stack, R31, Gamma_R2); + assume {:captureState "addr:0x7a0"}true; R8, Gamma_R8 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R9, Gamma_R9 := zero_extend32_32(bvadd32(R8[32:0], R9[32:0])), (Gamma_R9 && Gamma_R8); @@ -292,7 +296,7 @@ procedure get_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R2, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -427,12 +431,15 @@ procedure main() free ensures (memory_load8_le(mem, 69590bv64) == 0bv8); free ensures (memory_load8_le(mem, 69591bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x7c4"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x7c4"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x7c4"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R9, Gamma_R9 := 65536bv64, true; @@ -442,6 +449,7 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x7d8"}true; R0, Gamma_R0 := 97bv64, true; R1, Gamma_R1 := 10bv64, true; R2, Gamma_R2 := 58368bv64, true; @@ -451,12 +459,14 @@ procedure main() call get_two(); goto l000003dd; l000003dd: + assume {:captureState "addr:0x7f4"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4048bv64)) || L(mem, bvadd64(R8, 4048bv64))); call rely(); assert (L(mem, R8) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, R8, R0[32:0]), gamma_store32(Gamma_mem, R8, Gamma_R0); + assume {:captureState "addr:0x7fc"}true; call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); R0, Gamma_R0 := 0bv64, true; @@ -465,6 +475,7 @@ procedure main() call printf(); goto l0000040b; l0000040b: + assume {:captureState "addr:0x810"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -472,7 +483,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2096bv64) == 1bv8); free requires (memory_load8_le(mem, 2097bv64) == 0bv8); diff --git a/src/test/correct/function1/gcc/function1.expected b/src/test/correct/function1/gcc/function1.expected index 8957c04b8..4d0681d0c 100644 --- a/src/test/correct/function1/gcc/function1.expected +++ b/src/test/correct/function1/gcc/function1.expected @@ -1,86 +1,86 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2048bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R2: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2048bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -129,7 +129,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -138,12 +138,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_stack, R0, R1, R31, stack; free requires (memory_load8_le(mem, 2048bv64) == 1bv8); free requires (memory_load8_le(mem, 2049bv64) == 0bv8); @@ -237,10 +237,14 @@ procedure get_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lget_two: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); + assume {:captureState "addr:0x758"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R1[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R1); + assume {:captureState "addr:0x75c"}true; stack, Gamma_stack := memory_store64_le(stack, R31, R2), gamma_store64(Gamma_stack, R31, Gamma_R2); + assume {:captureState "addr:0x760"}true; R1, Gamma_R1 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R1[32:0], R0[32:0])), (Gamma_R0 && Gamma_R1); @@ -251,7 +255,7 @@ procedure get_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R2, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -362,12 +366,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x784"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x784"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x784"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 69632bv64, true; @@ -376,6 +383,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x798"}true; R2, Gamma_R2 := 58368bv64, true; R2, Gamma_R2 := (R2[64:32] ++ (21515bv16 ++ R2[16:0])), Gamma_R2; R2, Gamma_R2 := (R2[64:48] ++ (2bv16 ++ R2[32:0])), Gamma_R2; @@ -385,12 +393,14 @@ procedure main() call get_two(); goto l000003ec; l000003ec: + assume {:captureState "addr:0x7b4"}true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x7c0"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -402,6 +412,7 @@ procedure main() call printf(); goto l00000430; l00000430: + assume {:captureState "addr:0x7e0"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -409,7 +420,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2048bv64) == 1bv8); free requires (memory_load8_le(mem, 2049bv64) == 0bv8); diff --git a/src/test/correct/function1/gcc_O2/function1.expected b/src/test/correct/function1/gcc_O2/function1.expected index f7a142a97..64d3bc49f 100644 --- a/src/test/correct/function1/gcc_O2/function1.expected +++ b/src/test/correct/function1/gcc_O2/function1.expected @@ -1,66 +1,66 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R3: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R3: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2048bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R3: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R2: bv64; +var {:extern }R29: bv64; +var {:extern }R3: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2048bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,7 +109,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -118,12 +118,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure __printf_chk(); +procedure __printf_chk(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2048bv64) == 1bv8); free requires (memory_load8_le(mem, 2049bv64) == 0bv8); @@ -214,7 +214,7 @@ procedure __printf_chk(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R3, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R2, R29, R3, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -325,12 +325,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv64; - var Gamma_#1: bool; + var #1: bv64; + var Gamma_#1: bool; lmain: + assume {:captureState "addr:0x680"}true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); + assume {:captureState "addr:0x680"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#1, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#1, 8bv64), Gamma_R30); + assume {:captureState "addr:0x680"}true; R31, Gamma_R31 := #1, Gamma_#1; R1, Gamma_R1 := 69632bv64, true; R3, Gamma_R3 := bvadd64(R1, 20bv64), Gamma_R1; @@ -341,15 +344,18 @@ procedure main() call rely(); assert (L(mem, bvadd64(R1, 20bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R0); + assume {:captureState "addr:0x69c"}true; R1, Gamma_R1 := 0bv64, true; R1, Gamma_R1 := bvadd64(R1, 2056bv64), Gamma_R1; call rely(); assert (L(mem, bvadd64(R3, 4bv64)) ==> Gamma_R2); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R3, 4bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R3, 4bv64), Gamma_R2); + assume {:captureState "addr:0x6a8"}true; R30, Gamma_R30 := 1712bv64, true; call __printf_chk(); goto l0000021a; l0000021a: + assume {:captureState "addr:0x6b0"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function1/gcc_no_plt_no_pic/function1.expected b/src/test/correct/function1/gcc_no_plt_no_pic/function1.expected index 3dd41d9b9..8ae339712 100644 --- a/src/test/correct/function1/gcc_no_plt_no_pic/function1.expected +++ b/src/test/correct/function1/gcc_no_plt_no_pic/function1.expected @@ -1,86 +1,86 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2048bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R2: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2048bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -129,7 +129,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -138,12 +138,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_stack, R0, R1, R31, stack; free requires (memory_load8_le(mem, 2048bv64) == 1bv8); free requires (memory_load8_le(mem, 2049bv64) == 0bv8); @@ -237,10 +237,14 @@ procedure get_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lget_two: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); + assume {:captureState "addr:0x758"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R1[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R1); + assume {:captureState "addr:0x75c"}true; stack, Gamma_stack := memory_store64_le(stack, R31, R2), gamma_store64(Gamma_stack, R31, Gamma_R2); + assume {:captureState "addr:0x760"}true; R1, Gamma_R1 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R1[32:0], R0[32:0])), (Gamma_R0 && Gamma_R1); @@ -251,7 +255,7 @@ procedure get_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R2, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -362,12 +366,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x784"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x784"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x784"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 69632bv64, true; @@ -376,6 +383,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x798"}true; R2, Gamma_R2 := 58368bv64, true; R2, Gamma_R2 := (R2[64:32] ++ (21515bv16 ++ R2[16:0])), Gamma_R2; R2, Gamma_R2 := (R2[64:48] ++ (2bv16 ++ R2[32:0])), Gamma_R2; @@ -385,12 +393,14 @@ procedure main() call get_two(); goto l00000b44; l00000b44: + assume {:captureState "addr:0x7b4"}true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x7c0"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -402,6 +412,7 @@ procedure main() call printf(); goto l00000b88; l00000b88: + assume {:captureState "addr:0x7e0"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -409,7 +420,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2048bv64) == 1bv8); free requires (memory_load8_le(mem, 2049bv64) == 0bv8); diff --git a/src/test/correct/function1/gcc_pic/function1.expected b/src/test/correct/function1/gcc_pic/function1.expected index fa4260255..07a8d8148 100644 --- a/src/test/correct/function1/gcc_pic/function1.expected +++ b/src/test/correct/function1/gcc_pic/function1.expected @@ -1,86 +1,86 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2112bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R2: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2112bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -145,7 +145,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -154,12 +154,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure get_two() +procedure get_two() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_stack, R0, R1, R31, stack; free requires (memory_load8_le(mem, 2112bv64) == 1bv8); free requires (memory_load8_le(mem, 2113bv64) == 0bv8); @@ -285,10 +285,14 @@ procedure get_two() free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); { lget_two: + assume {:captureState "addr:0x794"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); + assume {:captureState "addr:0x798"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R1[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R1); + assume {:captureState "addr:0x79c"}true; stack, Gamma_stack := memory_store64_le(stack, R31, R2), gamma_store64(Gamma_stack, R31, Gamma_R2); + assume {:captureState "addr:0x7a0"}true; R1, Gamma_R1 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R1[32:0], R0[32:0])), (Gamma_R0 && Gamma_R1); @@ -299,7 +303,7 @@ procedure get_two() return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R2, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -442,12 +446,15 @@ procedure main() free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x7c4"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x7c4"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x7c4"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 65536bv64, true; @@ -457,6 +464,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x7d8"}true; R2, Gamma_R2 := 58368bv64, true; R2, Gamma_R2 := (R2[64:32] ++ (21515bv16 ++ R2[16:0])), Gamma_R2; R2, Gamma_R2 := (R2[64:48] ++ (2bv16 ++ R2[32:0])), Gamma_R2; @@ -466,6 +474,7 @@ procedure main() call get_two(); goto l000003ed; l000003ed: + assume {:captureState "addr:0x7f4"}true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -473,6 +482,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x800"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -485,6 +495,7 @@ procedure main() call printf(); goto l00000433; l00000433: + assume {:captureState "addr:0x820"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -492,7 +503,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2112bv64) == 1bv8); free requires (memory_load8_le(mem, 2113bv64) == 0bv8); diff --git a/src/test/correct/functions_with_params/clang/functions_with_params.expected b/src/test/correct/functions_with_params/clang/functions_with_params.expected index f900ce760..a1321a395 100644 --- a/src/test/correct/functions_with_params/clang/functions_with_params.expected +++ b/src/test/correct/functions_with_params/clang/functions_with_params.expected @@ -1,59 +1,59 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1912bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1912bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,12 +103,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_stack, R0, R29, R30, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -203,26 +203,33 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x718"}true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R29, 18446744073709551612bv64))), gamma_load32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64)); R30, Gamma_R30 := 1848bv64, true; call plus_one(); goto l00000366; l00000366: + assume {:captureState "addr:0x738"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R0); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 0bv64, true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -231,7 +238,7 @@ procedure main() return; } -procedure plus_one() +procedure plus_one() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 1912bv64) == 1bv8); free requires (memory_load8_le(mem, 1913bv64) == 0bv8); @@ -309,8 +316,10 @@ procedure plus_one() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lplus_one: + assume {:captureState "addr:0x74c"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x750"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; diff --git a/src/test/correct/functions_with_params/clang_O2/functions_with_params.expected b/src/test/correct/functions_with_params/clang_O2/functions_with_params.expected index f116be047..bbebaae99 100644 --- a/src/test/correct/functions_with_params/clang_O2/functions_with_params.expected +++ b/src/test/correct/functions_with_params/clang_O2/functions_with_params.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1848bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1848bv64); +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -155,6 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/functions_with_params/clang_no_plt_no_pic/functions_with_params.expected b/src/test/correct/functions_with_params/clang_no_plt_no_pic/functions_with_params.expected index 6b05b6a02..df53564d3 100644 --- a/src/test/correct/functions_with_params/clang_no_plt_no_pic/functions_with_params.expected +++ b/src/test/correct/functions_with_params/clang_no_plt_no_pic/functions_with_params.expected @@ -1,59 +1,59 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1912bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1912bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,12 +103,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_stack, R0, R29, R30, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -203,26 +203,33 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x718"}true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R29, 18446744073709551612bv64))), gamma_load32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64)); R30, Gamma_R30 := 1848bv64, true; call plus_one(); goto l000009b1; l000009b1: + assume {:captureState "addr:0x738"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R0); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 0bv64, true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -231,7 +238,7 @@ procedure main() return; } -procedure plus_one() +procedure plus_one() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 1912bv64) == 1bv8); free requires (memory_load8_le(mem, 1913bv64) == 0bv8); @@ -309,8 +316,10 @@ procedure plus_one() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lplus_one: + assume {:captureState "addr:0x74c"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x750"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; diff --git a/src/test/correct/functions_with_params/clang_pic/functions_with_params.expected b/src/test/correct/functions_with_params/clang_pic/functions_with_params.expected index 6b05b6a02..df53564d3 100644 --- a/src/test/correct/functions_with_params/clang_pic/functions_with_params.expected +++ b/src/test/correct/functions_with_params/clang_pic/functions_with_params.expected @@ -1,59 +1,59 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1912bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1912bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,12 +103,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_stack, R0, R29, R30, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -203,26 +203,33 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x718"}true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R29, 18446744073709551612bv64))), gamma_load32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64)); R30, Gamma_R30 := 1848bv64, true; call plus_one(); goto l000009b1; l000009b1: + assume {:captureState "addr:0x738"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R0); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 0bv64, true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -231,7 +238,7 @@ procedure main() return; } -procedure plus_one() +procedure plus_one() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 1912bv64) == 1bv8); free requires (memory_load8_le(mem, 1913bv64) == 0bv8); @@ -309,8 +316,10 @@ procedure plus_one() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lplus_one: + assume {:captureState "addr:0x74c"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x750"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; diff --git a/src/test/correct/functions_with_params/gcc/functions_with_params.expected b/src/test/correct/functions_with_params/gcc/functions_with_params.expected index a5d5580f6..22c8d80c9 100644 --- a/src/test/correct/functions_with_params/gcc/functions_with_params.expected +++ b/src/test/correct/functions_with_params/gcc/functions_with_params.expected @@ -1,57 +1,57 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1904bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1904bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,12 +101,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -201,24 +201,31 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x714"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x714"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 1844bv64, true; call plus_one(); goto l0000035c; l0000035c: + assume {:captureState "addr:0x734"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x734"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -226,7 +233,7 @@ procedure main() return; } -procedure plus_one() +procedure plus_one() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 1904bv64) == 1bv8); free requires (memory_load8_le(mem, 1905bv64) == 0bv8); @@ -304,8 +311,10 @@ procedure plus_one() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lplus_one: + assume {:captureState "addr:0x744"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 1bv32)), Gamma_R0; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; diff --git a/src/test/correct/functions_with_params/gcc_O2/functions_with_params.expected b/src/test/correct/functions_with_params/gcc_O2/functions_with_params.expected index 811d75341..4fa6efe6f 100644 --- a/src/test/correct/functions_with_params/gcc_O2/functions_with_params.expected +++ b/src/test/correct/functions_with_params/gcc_O2/functions_with_params.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1916bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1916bv64); +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -155,6 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/functions_with_params/gcc_no_plt_no_pic/functions_with_params.expected b/src/test/correct/functions_with_params/gcc_no_plt_no_pic/functions_with_params.expected index 5feac7ab2..aadc1fe40 100644 --- a/src/test/correct/functions_with_params/gcc_no_plt_no_pic/functions_with_params.expected +++ b/src/test/correct/functions_with_params/gcc_no_plt_no_pic/functions_with_params.expected @@ -1,57 +1,57 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1904bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1904bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,12 +101,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -201,24 +201,31 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x714"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x714"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 1844bv64, true; call plus_one(); goto l00000993; l00000993: + assume {:captureState "addr:0x734"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x734"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -226,7 +233,7 @@ procedure main() return; } -procedure plus_one() +procedure plus_one() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 1904bv64) == 1bv8); free requires (memory_load8_le(mem, 1905bv64) == 0bv8); @@ -304,8 +311,10 @@ procedure plus_one() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lplus_one: + assume {:captureState "addr:0x744"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 1bv32)), Gamma_R0; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; diff --git a/src/test/correct/functions_with_params/gcc_pic/functions_with_params.expected b/src/test/correct/functions_with_params/gcc_pic/functions_with_params.expected index 5feac7ab2..aadc1fe40 100644 --- a/src/test/correct/functions_with_params/gcc_pic/functions_with_params.expected +++ b/src/test/correct/functions_with_params/gcc_pic/functions_with_params.expected @@ -1,57 +1,57 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1904bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1904bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,12 +101,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -201,24 +201,31 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x714"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x714"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 1844bv64, true; call plus_one(); goto l00000993; l00000993: + assume {:captureState "addr:0x734"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x734"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -226,7 +233,7 @@ procedure main() return; } -procedure plus_one() +procedure plus_one() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 1904bv64) == 1bv8); free requires (memory_load8_le(mem, 1905bv64) == 0bv8); @@ -304,8 +311,10 @@ procedure plus_one() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lplus_one: + assume {:captureState "addr:0x744"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 1bv32)), Gamma_R0; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; diff --git a/src/test/correct/ifbranches/clang/ifbranches.expected b/src/test/correct/ifbranches/clang/ifbranches.expected index 2fceaf281..dfe63d190 100644 --- a/src/test/correct/ifbranches/clang/ifbranches.expected +++ b/src/test/correct/ifbranches/clang/ifbranches.expected @@ -1,54 +1,54 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,12 +98,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -197,22 +197,27 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); + assume {:captureState "addr:0x720"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 0bv33))), (Gamma_R8 && Gamma_#4); @@ -238,19 +243,26 @@ procedure main() } goto l00000397; l0000035a: + assume {:captureState "addr:0x748"}true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x74c"}true; goto l0000036d; l00000397: + assume {:captureState "addr:0x738"}true; goto l00000398; l00000398: + assume {:captureState "addr:0x73c"}true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x740"}true; goto l0000036d; l0000036d: + assume {:captureState "addr:0x754"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x75c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/ifbranches/clang_O2/ifbranches.expected b/src/test/correct/ifbranches/clang_O2/ifbranches.expected index ff322ae57..9137eaa77 100644 --- a/src/test/correct/ifbranches/clang_O2/ifbranches.expected +++ b/src/test/correct/ifbranches/clang_O2/ifbranches.expected @@ -1,23 +1,23 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,7 +58,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -67,12 +67,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, R0, R8; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -164,17 +164,18 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 2bv64, true; #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); diff --git a/src/test/correct/ifbranches/clang_no_plt_no_pic/ifbranches.expected b/src/test/correct/ifbranches/clang_no_plt_no_pic/ifbranches.expected index eec93a45e..be2b089f5 100644 --- a/src/test/correct/ifbranches/clang_no_plt_no_pic/ifbranches.expected +++ b/src/test/correct/ifbranches/clang_no_plt_no_pic/ifbranches.expected @@ -1,54 +1,54 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,12 +98,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -197,22 +197,27 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); + assume {:captureState "addr:0x720"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 0bv33))), (Gamma_R8 && Gamma_#4); @@ -238,19 +243,26 @@ procedure main() } goto l00000a03; l000009c6: + assume {:captureState "addr:0x748"}true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x74c"}true; goto l000009d9; l00000a03: + assume {:captureState "addr:0x738"}true; goto l00000a04; l00000a04: + assume {:captureState "addr:0x73c"}true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x740"}true; goto l000009d9; l000009d9: + assume {:captureState "addr:0x754"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x75c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/ifbranches/clang_pic/ifbranches.expected b/src/test/correct/ifbranches/clang_pic/ifbranches.expected index eec93a45e..be2b089f5 100644 --- a/src/test/correct/ifbranches/clang_pic/ifbranches.expected +++ b/src/test/correct/ifbranches/clang_pic/ifbranches.expected @@ -1,54 +1,54 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,12 +98,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -197,22 +197,27 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); + assume {:captureState "addr:0x720"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 0bv33))), (Gamma_R8 && Gamma_#4); @@ -238,19 +243,26 @@ procedure main() } goto l00000a03; l000009c6: + assume {:captureState "addr:0x748"}true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x74c"}true; goto l000009d9; l00000a03: + assume {:captureState "addr:0x738"}true; goto l00000a04; l00000a04: + assume {:captureState "addr:0x73c"}true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x740"}true; goto l000009d9; l000009d9: + assume {:captureState "addr:0x754"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x75c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/ifbranches/gcc/ifbranches.expected b/src/test/correct/ifbranches/gcc/ifbranches.expected index fa6737faa..9db490ac8 100644 --- a/src/test/correct/ifbranches/gcc/ifbranches.expected +++ b/src/test/correct/ifbranches/gcc/ifbranches.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,12 +96,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -195,21 +195,25 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store64_le(stack, R31, R1), gamma_store64(Gamma_stack, R31, Gamma_R1); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), true); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -222,17 +226,23 @@ procedure main() } goto l00000369; l00000330: + assume {:captureState "addr:0x73c"}true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x740"}true; goto l00000342; l00000369: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x734"}true; goto l00000342; l00000342: + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 1bv32)), Gamma_R0; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/ifbranches/gcc_O2/ifbranches.expected b/src/test/correct/ifbranches/gcc_O2/ifbranches.expected index 4e0e04f8d..fb26beabb 100644 --- a/src/test/correct/ifbranches/gcc_O2/ifbranches.expected +++ b/src/test/correct/ifbranches/gcc_O2/ifbranches.expected @@ -1,21 +1,21 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }mem: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,7 +56,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -65,12 +65,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -162,17 +162,18 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv32; - var CF: bv1; - var Gamma_#1: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #1: bv32; + var CF: bv1; + var Gamma_#1: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x600"}true; #1, Gamma_#1 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#1, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#1); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#1, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967296bv33))), (Gamma_R0 && Gamma_#1); diff --git a/src/test/correct/ifbranches/gcc_no_plt_no_pic/ifbranches.expected b/src/test/correct/ifbranches/gcc_no_plt_no_pic/ifbranches.expected index 28a72d1fe..a94ff72dd 100644 --- a/src/test/correct/ifbranches/gcc_no_plt_no_pic/ifbranches.expected +++ b/src/test/correct/ifbranches/gcc_no_plt_no_pic/ifbranches.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,12 +96,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -195,21 +195,25 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store64_le(stack, R31, R1), gamma_store64(Gamma_stack, R31, Gamma_R1); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), true); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -222,17 +226,23 @@ procedure main() } goto l0000099c; l00000963: + assume {:captureState "addr:0x73c"}true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x740"}true; goto l00000975; l0000099c: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x734"}true; goto l00000975; l00000975: + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 1bv32)), Gamma_R0; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/ifbranches/gcc_pic/ifbranches.expected b/src/test/correct/ifbranches/gcc_pic/ifbranches.expected index 28a72d1fe..a94ff72dd 100644 --- a/src/test/correct/ifbranches/gcc_pic/ifbranches.expected +++ b/src/test/correct/ifbranches/gcc_pic/ifbranches.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,12 +96,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -195,21 +195,25 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store64_le(stack, R31, R1), gamma_store64(Gamma_stack, R31, Gamma_R1); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), true); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -222,17 +226,23 @@ procedure main() } goto l0000099c; l00000963: + assume {:captureState "addr:0x73c"}true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x740"}true; goto l00000975; l0000099c: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x734"}true; goto l00000975; l00000975: + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 1bv32)), Gamma_R0; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/ifglobal/clang/ifglobal.expected b/src/test/correct/ifglobal/clang/ifglobal.expected index c1562471a..32a6b4719 100644 --- a/src/test/correct/ifglobal/clang/ifglobal.expected +++ b/src/test/correct/ifglobal/clang/ifglobal.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,12 +96,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -194,19 +194,21 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -234,15 +236,19 @@ procedure main() } goto l00000343; l00000343: + assume {:captureState "addr:0x730"}true; goto l00000344; l00000344: + assume {:captureState "addr:0x734"}true; R8, Gamma_R8 := 1bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); + assume {:captureState "addr:0x73c"}true; goto l0000032c; l0000032c: + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/ifglobal/clang_O2/ifglobal.expected b/src/test/correct/ifglobal/clang_O2/ifglobal.expected index ea6cfcaf2..b235ef11d 100644 --- a/src/test/correct/ifglobal/clang_O2/ifglobal.expected +++ b/src/test/correct/ifglobal/clang_O2/ifglobal.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,12 +85,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -182,6 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -191,13 +192,16 @@ procedure main() } goto l000002f8; l000002dc: + assume {:captureState "addr:0x728"}true; R9, Gamma_R9 := 1bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := 0bv64, true; return; l000002f8: + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/ifglobal/clang_no_plt_no_pic/ifglobal.expected b/src/test/correct/ifglobal/clang_no_plt_no_pic/ifglobal.expected index 3bc70940e..bd525c686 100644 --- a/src/test/correct/ifglobal/clang_no_plt_no_pic/ifglobal.expected +++ b/src/test/correct/ifglobal/clang_no_plt_no_pic/ifglobal.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,12 +96,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -194,19 +194,21 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -234,15 +236,19 @@ procedure main() } goto l00000952; l00000952: + assume {:captureState "addr:0x730"}true; goto l00000953; l00000953: + assume {:captureState "addr:0x734"}true; R8, Gamma_R8 := 1bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); + assume {:captureState "addr:0x73c"}true; goto l0000093b; l0000093b: + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/ifglobal/clang_pic/ifglobal.expected b/src/test/correct/ifglobal/clang_pic/ifglobal.expected index b4a9fc10e..051cfdaf2 100644 --- a/src/test/correct/ifglobal/clang_pic/ifglobal.expected +++ b/src/test/correct/ifglobal/clang_pic/ifglobal.expected @@ -1,60 +1,60 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,7 +103,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -112,12 +112,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -226,19 +226,21 @@ procedure main() free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x758"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4040bv64)) || L(mem, bvadd64(R8, 4040bv64))); @@ -268,8 +270,10 @@ procedure main() } goto l00000352; l00000352: + assume {:captureState "addr:0x774"}true; goto l00000353; l00000353: + assume {:captureState "addr:0x778"}true; R8, Gamma_R8 := 1bv64, true; R9, Gamma_R9 := 65536bv64, true; call rely(); @@ -277,8 +281,10 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x784"}true; goto l0000033b; l0000033b: + assume {:captureState "addr:0x78c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/ifglobal/gcc/ifglobal.expected b/src/test/correct/ifglobal/gcc/ifglobal.expected index 526a339ac..dcf9e5bd9 100644 --- a/src/test/correct/ifglobal/gcc/ifglobal.expected +++ b/src/test/correct/ifglobal/gcc/ifglobal.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,17 +186,18 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -212,14 +213,17 @@ procedure main() } goto l00000311; l00000311: + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x734"}true; goto l00000302; l00000302: + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/ifglobal/gcc_O2/ifglobal.expected b/src/test/correct/ifglobal/gcc_O2/ifglobal.expected index 342dd9746..80272f3dc 100644 --- a/src/test/correct/ifglobal/gcc_O2/ifglobal.expected +++ b/src/test/correct/ifglobal/gcc_O2/ifglobal.expected @@ -1,40 +1,40 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,12 +84,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -181,6 +181,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; R0, Gamma_R0 := 69632bv64, true; call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, bvadd64(R0, 20bv64))), (gamma_load32(Gamma_mem, bvadd64(R0, 20bv64)) || L(mem, bvadd64(R0, 20bv64))); @@ -190,12 +191,15 @@ procedure main() } goto l00000396; l00000396: + assume {:captureState "addr:0x60c"}true; R1, Gamma_R1 := 1bv64, true; call rely(); assert (L(mem, bvadd64(R0, 20bv64)) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R0, 20bv64), R1[32:0]), gamma_store32(Gamma_mem, bvadd64(R0, 20bv64), Gamma_R1); + assume {:captureState "addr:0x610"}true; goto l000001b7; l000001b7: + assume {:captureState "addr:0x614"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/ifglobal/gcc_no_plt_no_pic/ifglobal.expected b/src/test/correct/ifglobal/gcc_no_plt_no_pic/ifglobal.expected index 64a738f75..2f04514e3 100644 --- a/src/test/correct/ifglobal/gcc_no_plt_no_pic/ifglobal.expected +++ b/src/test/correct/ifglobal/gcc_no_plt_no_pic/ifglobal.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,17 +186,18 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -212,14 +213,17 @@ procedure main() } goto l000008e5; l000008e5: + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x734"}true; goto l000008d6; l000008d6: + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/ifglobal/gcc_pic/ifglobal.expected b/src/test/correct/ifglobal/gcc_pic/ifglobal.expected index 537c1eafa..7b18bc7da 100644 --- a/src/test/correct/ifglobal/gcc_pic/ifglobal.expected +++ b/src/test/correct/ifglobal/gcc_pic/ifglobal.expected @@ -1,54 +1,54 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,12 +106,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -218,17 +218,18 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -245,6 +246,7 @@ procedure main() } goto l00000312; l00000312: + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -252,8 +254,10 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x774"}true; goto l00000303; l00000303: + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/indirect_call/clang_O2/indirect_call.expected b/src/test/correct/indirect_call/clang_O2/indirect_call.expected index b1f2385f4..365ea1180 100644 --- a/src/test/correct/indirect_call/clang_O2/indirect_call.expected +++ b/src/test/correct/indirect_call/clang_O2/indirect_call.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1952bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1952bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -120,7 +120,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -129,12 +129,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -313,12 +313,15 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x760"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x760"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x760"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 0bv64, true; @@ -327,12 +330,14 @@ procedure main() call puts(); goto l00000320; l00000320: + assume {:captureState "addr:0x774"}true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 1956bv64), Gamma_R0; R30, Gamma_R30 := 1920bv64, true; call puts(); goto l00000332; l00000332: + assume {:captureState "addr:0x780"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -340,7 +345,7 @@ procedure main() return; } -procedure puts(); +procedure puts(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1952bv64) == 1bv8); free requires (memory_load8_le(mem, 1953bv64) == 0bv8); diff --git a/src/test/correct/indirect_call/gcc_O2/indirect_call.expected b/src/test/correct/indirect_call/gcc_O2/indirect_call.expected index 9064b0f6f..533297bf6 100644 --- a/src/test/correct/indirect_call/gcc_O2/indirect_call.expected +++ b/src/test/correct/indirect_call/gcc_O2/indirect_call.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1984bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1984bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -126,7 +126,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -135,12 +135,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure greet() +procedure greet() modifies Gamma_R0, Gamma_R16, Gamma_R17, R0, R16, R17; free requires (memory_load8_le(mem, 1984bv64) == 1bv8); free requires (memory_load8_le(mem, 1985bv64) == 0bv8); @@ -312,6 +312,7 @@ procedure greet() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lgreet: + assume {:captureState "addr:0x7a0"}true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 1992bv64), Gamma_R0; call puts(); @@ -319,7 +320,7 @@ procedure greet() assume false; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -510,12 +511,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv64; - var Gamma_#1: bool; + var #1: bv64; + var Gamma_#1: bool; lmain: + assume {:captureState "addr:0x640"}true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); + assume {:captureState "addr:0x640"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#1, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#1, 8bv64), Gamma_R30); + assume {:captureState "addr:0x640"}true; R31, Gamma_R31 := #1, Gamma_#1; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2008bv64), Gamma_R0; @@ -524,10 +528,12 @@ procedure main() call puts(); goto l000001ef; l000001ef: + assume {:captureState "addr:0x654"}true; R30, Gamma_R30 := 1624bv64, true; call greet(); goto l00000205; l00000205: + assume {:captureState "addr:0x658"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -535,7 +541,7 @@ procedure main() return; } -procedure puts(); +procedure puts(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1984bv64) == 1bv8); free requires (memory_load8_le(mem, 1985bv64) == 0bv8); diff --git a/src/test/correct/initialisation/clang/initialisation.expected b/src/test/correct/initialisation/clang/initialisation.expected index 1e3eef5ac..78613bbad 100644 --- a/src/test/correct/initialisation/clang/initialisation.expected +++ b/src/test/correct/initialisation/clang/initialisation.expected @@ -1,86 +1,86 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R11: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R11: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $a_addr: bv64; -axiom {:extern } ($a_addr == 69696bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69680bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69684bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R11: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R11: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$a_addr: bv64; +axiom {:extern }($a_addr == 69696bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69680bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69684bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd65(bv65, bv65) returns (bv65); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp64(bv64, bv64) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp65(bv65, bv65) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd65(bv65, bv65) returns (bv65); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp64(bv64, bv64) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp65(bv65, bv65) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_64(bv64) returns (bv65); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_64(bv64) returns (bv65); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_64(bv64) returns (bv65); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_64(bv64) returns (bv65); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -121,7 +121,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -130,12 +130,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R11, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R11, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -253,17 +253,18 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv64; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv64; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; R9, Gamma_R9 := bvadd64(R9, 64bv64), Gamma_R9; @@ -274,6 +275,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R11, 48bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R11, 48bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R11, 48bv64), Gamma_R10); + assume {:captureState "addr:0x72c"}true; R11, Gamma_R11 := 69632bv64, true; call rely(); R10, Gamma_R10 := memory_load64_le(mem, bvadd64(R11, 56bv64)), (gamma_load64(Gamma_mem, bvadd64(R11, 56bv64)) || L(mem, bvadd64(R11, 56bv64))); @@ -286,12 +288,14 @@ procedure main() call rely(); assert (L(mem, bvadd64(R11, 56bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R11, 56bv64), R10), gamma_store64(Gamma_mem, bvadd64(R11, 56bv64), Gamma_R10); + assume {:captureState "addr:0x73c"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 64bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 64bv64)) || L(mem, bvadd64(R8, 64bv64))); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 3bv32)), Gamma_R8; call rely(); assert (L(mem, bvadd64(R9, 4bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 4bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 4bv64), Gamma_R8); + assume {:captureState "addr:0x748"}true; R9, Gamma_R9 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend56_8(memory_load8_le(mem, bvadd64(R9, 52bv64))), (gamma_load8(Gamma_mem, bvadd64(R9, 52bv64)) || L(mem, bvadd64(R9, 52bv64))); @@ -299,6 +303,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R9, 52bv64), R8[8:0]), gamma_store8(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); + assume {:captureState "addr:0x758"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/initialisation/clang_O2/initialisation.expected b/src/test/correct/initialisation/clang_O2/initialisation.expected index fde5ddb83..d9f717d10 100644 --- a/src/test/correct/initialisation/clang_O2/initialisation.expected +++ b/src/test/correct/initialisation/clang_O2/initialisation.expected @@ -1,88 +1,88 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R11: bool; -var {:extern } Gamma_R12: bool; -var {:extern } Gamma_R13: bool; -var {:extern } Gamma_R14: bool; -var {:extern } Gamma_R15: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R11: bv64; -var {:extern } R12: bv64; -var {:extern } R13: bv64; -var {:extern } R14: bv64; -var {:extern } R15: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $a_addr: bv64; -axiom {:extern } ($a_addr == 69696bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69680bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69684bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R11: bool; +var {:extern }Gamma_R12: bool; +var {:extern }Gamma_R13: bool; +var {:extern }Gamma_R14: bool; +var {:extern }Gamma_R15: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R11: bv64; +var {:extern }R12: bv64; +var {:extern }R13: bv64; +var {:extern }R14: bv64; +var {:extern }R15: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$a_addr: bv64; +axiom {:extern }($a_addr == 69696bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69680bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69684bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -123,7 +123,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -132,12 +132,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R11, Gamma_R12, Gamma_R13, Gamma_R14, Gamma_R15, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R11, R12, R13, R14, R15, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -256,6 +256,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R10, Gamma_R10 := 69632bv64, true; R10, Gamma_R10 := bvadd64(R10, 64bv64), Gamma_R10; R8, Gamma_R8 := 69632bv64, true; @@ -276,15 +277,19 @@ procedure main() call rely(); assert (L(mem, bvadd64(R10, 4bv64)) ==> Gamma_R11); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R10, 4bv64), R11[32:0]), gamma_store32(Gamma_mem, bvadd64(R10, 4bv64), Gamma_R11); + assume {:captureState "addr:0x748"}true; R10, Gamma_R10 := zero_extend32_32(bvadd32(R15[32:0], 1bv32)), Gamma_R15; call rely(); assert (L(mem, bvadd64(R8, 48bv64)) ==> Gamma_R13); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 48bv64), R13[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 48bv64), Gamma_R13); + assume {:captureState "addr:0x750"}true; call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R14); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R9, 56bv64), R14), gamma_store64(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R14); + assume {:captureState "addr:0x754"}true; call rely(); assert (L(mem, bvadd64(R12, 52bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R12, 52bv64), R10[8:0]), gamma_store8(Gamma_mem, bvadd64(R12, 52bv64), Gamma_R10); + assume {:captureState "addr:0x758"}true; return; } diff --git a/src/test/correct/initialisation/clang_no_plt_no_pic/initialisation.expected b/src/test/correct/initialisation/clang_no_plt_no_pic/initialisation.expected index 1e3eef5ac..78613bbad 100644 --- a/src/test/correct/initialisation/clang_no_plt_no_pic/initialisation.expected +++ b/src/test/correct/initialisation/clang_no_plt_no_pic/initialisation.expected @@ -1,86 +1,86 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R11: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R11: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $a_addr: bv64; -axiom {:extern } ($a_addr == 69696bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69680bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69684bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R11: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R11: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$a_addr: bv64; +axiom {:extern }($a_addr == 69696bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69680bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69684bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd65(bv65, bv65) returns (bv65); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp64(bv64, bv64) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp65(bv65, bv65) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd65(bv65, bv65) returns (bv65); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp64(bv64, bv64) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp65(bv65, bv65) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_64(bv64) returns (bv65); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_64(bv64) returns (bv65); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_64(bv64) returns (bv65); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_64(bv64) returns (bv65); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -121,7 +121,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -130,12 +130,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R11, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R11, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -253,17 +253,18 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv64; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv64; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; R9, Gamma_R9 := bvadd64(R9, 64bv64), Gamma_R9; @@ -274,6 +275,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R11, 48bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R11, 48bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R11, 48bv64), Gamma_R10); + assume {:captureState "addr:0x72c"}true; R11, Gamma_R11 := 69632bv64, true; call rely(); R10, Gamma_R10 := memory_load64_le(mem, bvadd64(R11, 56bv64)), (gamma_load64(Gamma_mem, bvadd64(R11, 56bv64)) || L(mem, bvadd64(R11, 56bv64))); @@ -286,12 +288,14 @@ procedure main() call rely(); assert (L(mem, bvadd64(R11, 56bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R11, 56bv64), R10), gamma_store64(Gamma_mem, bvadd64(R11, 56bv64), Gamma_R10); + assume {:captureState "addr:0x73c"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 64bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 64bv64)) || L(mem, bvadd64(R8, 64bv64))); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 3bv32)), Gamma_R8; call rely(); assert (L(mem, bvadd64(R9, 4bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 4bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 4bv64), Gamma_R8); + assume {:captureState "addr:0x748"}true; R9, Gamma_R9 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend56_8(memory_load8_le(mem, bvadd64(R9, 52bv64))), (gamma_load8(Gamma_mem, bvadd64(R9, 52bv64)) || L(mem, bvadd64(R9, 52bv64))); @@ -299,6 +303,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R9, 52bv64), R8[8:0]), gamma_store8(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); + assume {:captureState "addr:0x758"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/initialisation/clang_pic/initialisation.expected b/src/test/correct/initialisation/clang_pic/initialisation.expected index 1b5b28dfd..a23c84893 100644 --- a/src/test/correct/initialisation/clang_pic/initialisation.expected +++ b/src/test/correct/initialisation/clang_pic/initialisation.expected @@ -1,84 +1,84 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $a_addr: bv64; -axiom {:extern } ($a_addr == 69696bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69680bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69684bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$a_addr: bv64; +axiom {:extern }($a_addr == 69696bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69680bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69684bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd65(bv65, bv65) returns (bv65); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp64(bv64, bv64) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp65(bv65, bv65) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd65(bv65, bv65) returns (bv65); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp64(bv64, bv64) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp65(bv65, bv65) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_64(bv64) returns (bv65); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_64(bv64) returns (bv65); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_64(bv64) returns (bv65); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_64(bv64) returns (bv65); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -151,7 +151,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69566bv64) == 0bv8); free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -160,12 +160,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -347,17 +347,18 @@ procedure main() free ensures (memory_load8_le(mem, 69566bv64) == 0bv8); free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); { - var #4: bv64; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv64; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x794"}true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); @@ -370,6 +371,7 @@ procedure main() call rely(); assert (L(mem, R10) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R10, R8[32:0]), gamma_store32(Gamma_mem, R10, Gamma_R8); + assume {:captureState "addr:0x7ac"}true; R10, Gamma_R10 := 65536bv64, true; call rely(); R10, Gamma_R10 := memory_load64_le(mem, bvadd64(R10, 4016bv64)), (gamma_load64(Gamma_mem, bvadd64(R10, 4016bv64)) || L(mem, bvadd64(R10, 4016bv64))); @@ -384,12 +386,14 @@ procedure main() call rely(); assert (L(mem, R10) ==> Gamma_R8); mem, Gamma_mem := memory_store64_le(mem, R10, R8), gamma_store64(Gamma_mem, R10, Gamma_R8); + assume {:captureState "addr:0x7c0"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R9)), (gamma_load32(Gamma_mem, R9) || L(mem, R9)); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 3bv32)), Gamma_R8; call rely(); assert (L(mem, bvadd64(R9, 4bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 4bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 4bv64), Gamma_R8); + assume {:captureState "addr:0x7cc"}true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4048bv64)) || L(mem, bvadd64(R9, 4048bv64))); @@ -399,6 +403,7 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x7e0"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/initialisation/gcc/initialisation.expected b/src/test/correct/initialisation/gcc/initialisation.expected index 617c09c2e..cea56edea 100644 --- a/src/test/correct/initialisation/gcc/initialisation.expected +++ b/src/test/correct/initialisation/gcc/initialisation.expected @@ -1,74 +1,74 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $a_addr: bv64; -axiom {:extern } ($a_addr == 69664bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69648bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$a_addr: bv64; +axiom {:extern }($a_addr == 69664bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69648bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,7 +109,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -118,12 +118,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -242,6 +242,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -252,6 +253,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -262,6 +264,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store64_le(mem, R0, R1), gamma_store64(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 32bv64), Gamma_R0; call rely(); @@ -272,6 +275,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R0, 4bv64)) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R0, 4bv64), R1[32:0]), gamma_store32(Gamma_mem, bvadd64(R0, 4bv64), Gamma_R1); + assume {:captureState "addr:0x764"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -283,6 +287,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x784"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/initialisation/gcc_O2/initialisation.expected b/src/test/correct/initialisation/gcc_O2/initialisation.expected index 8c5215b05..61ab8d5a3 100644 --- a/src/test/correct/initialisation/gcc_O2/initialisation.expected +++ b/src/test/correct/initialisation/gcc_O2/initialisation.expected @@ -1,84 +1,84 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R3: bool; -var {:extern } Gamma_R4: bool; -var {:extern } Gamma_R5: bool; -var {:extern } Gamma_R6: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R3: bv64; -var {:extern } R4: bv64; -var {:extern } R5: bv64; -var {:extern } R6: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $a_addr: bv64; -axiom {:extern } ($a_addr == 69664bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69648bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69672bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R3: bool; +var {:extern }Gamma_R4: bool; +var {:extern }Gamma_R5: bool; +var {:extern }Gamma_R6: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }R3: bv64; +var {:extern }R4: bv64; +var {:extern }R5: bv64; +var {:extern }R6: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$a_addr: bv64; +axiom {:extern }($a_addr == 69664bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69648bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69672bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -119,7 +119,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -128,12 +128,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R3, Gamma_R4, Gamma_R5, Gamma_R6, Gamma_mem, R0, R1, R2, R3, R4, R5, R6, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -253,6 +253,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; R5, Gamma_R5 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R5, 16bv64), Gamma_R5; R0, Gamma_R0 := 0bv64, true; @@ -270,15 +271,19 @@ procedure main() call rely(); assert (L(mem, bvadd64(R5, 16bv64)) ==> Gamma_R6); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R5, 16bv64), R6[32:0]), gamma_store32(Gamma_mem, bvadd64(R5, 16bv64), Gamma_R6); + assume {:captureState "addr:0x628"}true; R3, Gamma_R3 := zero_extend32_32(bvadd32(R3[32:0], 3bv32)), Gamma_R3; call rely(); assert (L(mem, bvadd64(R1, 8bv64)) ==> Gamma_R4); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R1, 8bv64), R4), gamma_store64(Gamma_mem, bvadd64(R1, 8bv64), Gamma_R4); + assume {:captureState "addr:0x630"}true; call rely(); assert (L(mem, bvadd64(R1, 20bv64)) ==> Gamma_R3); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R3[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R3); + assume {:captureState "addr:0x634"}true; call rely(); assert (L(mem, bvadd64(R1, 24bv64)) ==> Gamma_R2); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R1, 24bv64), R2[8:0]), gamma_store8(Gamma_mem, bvadd64(R1, 24bv64), Gamma_R2); + assume {:captureState "addr:0x638"}true; return; } diff --git a/src/test/correct/initialisation/gcc_no_plt_no_pic/initialisation.expected b/src/test/correct/initialisation/gcc_no_plt_no_pic/initialisation.expected index 617c09c2e..cea56edea 100644 --- a/src/test/correct/initialisation/gcc_no_plt_no_pic/initialisation.expected +++ b/src/test/correct/initialisation/gcc_no_plt_no_pic/initialisation.expected @@ -1,74 +1,74 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $a_addr: bv64; -axiom {:extern } ($a_addr == 69664bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69648bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$a_addr: bv64; +axiom {:extern }($a_addr == 69664bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69648bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,7 +109,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -118,12 +118,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -242,6 +242,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -252,6 +253,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -262,6 +264,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store64_le(mem, R0, R1), gamma_store64(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 32bv64), Gamma_R0; call rely(); @@ -272,6 +275,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R0, 4bv64)) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R0, 4bv64), R1[32:0]), gamma_store32(Gamma_mem, bvadd64(R0, 4bv64), Gamma_R1); + assume {:captureState "addr:0x764"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -283,6 +287,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x784"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/initialisation/gcc_pic/initialisation.expected b/src/test/correct/initialisation/gcc_pic/initialisation.expected index af86755b9..57dd25c5e 100644 --- a/src/test/correct/initialisation/gcc_pic/initialisation.expected +++ b/src/test/correct/initialisation/gcc_pic/initialisation.expected @@ -1,74 +1,74 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $a_addr: bv64; -axiom {:extern } ($a_addr == 69664bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69648bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$a_addr: bv64; +axiom {:extern }($a_addr == 69664bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69648bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -141,7 +141,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -150,12 +150,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -338,6 +338,7 @@ procedure main() free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x794"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4048bv64)) || L(mem, bvadd64(R0, 4048bv64))); @@ -350,6 +351,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x7ac"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4040bv64)) || L(mem, bvadd64(R0, 4040bv64))); @@ -362,6 +364,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store64_le(mem, R0, R1), gamma_store64(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x7c8"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -374,6 +377,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R0, 4bv64)) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R0, 4bv64), R1[32:0]), gamma_store32(Gamma_mem, bvadd64(R0, 4bv64), Gamma_R1); + assume {:captureState "addr:0x7e4"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -387,6 +391,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x804"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/jumptable/clang_O2/jumptable.expected b/src/test/correct/jumptable/clang_O2/jumptable.expected index 35a1c95ff..4cf96683d 100644 --- a/src/test/correct/jumptable/clang_O2/jumptable.expected +++ b/src/test/correct/jumptable/clang_O2/jumptable.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1916bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69680bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1916bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69680bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -78,7 +78,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,12 +87,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -188,6 +188,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x750"}true; R8, Gamma_R8 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); @@ -196,5 +197,6 @@ procedure main() call rely(); assert (L(mem, bvadd64(R8, 48bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 48bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 48bv64), Gamma_R9); + assume {:captureState "addr:0x760"}true; return; } diff --git a/src/test/correct/jumptable/gcc_O2/jumptable.expected b/src/test/correct/jumptable/gcc_O2/jumptable.expected index d158bab37..3906a8378 100644 --- a/src/test/correct/jumptable/gcc_O2/jumptable.expected +++ b/src/test/correct/jumptable/gcc_O2/jumptable.expected @@ -1,65 +1,65 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1976bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69648bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1976bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69648bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,7 +100,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,12 +109,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure add_six() +procedure add_six() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 1976bv64) == 1bv8); free requires (memory_load8_le(mem, 1977bv64) == 0bv8); @@ -190,6 +190,7 @@ procedure add_six() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { ladd_six: + assume {:captureState "addr:0x774"}true; R1, Gamma_R1 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); @@ -197,10 +198,11 @@ procedure add_six() call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); + assume {:captureState "addr:0x780"}true; return; } -procedure add_two() +procedure add_two() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 1976bv64) == 1bv8); free requires (memory_load8_le(mem, 1977bv64) == 0bv8); @@ -276,6 +278,7 @@ procedure add_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { ladd_two: + assume {:captureState "addr:0x760"}true; R1, Gamma_R1 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); @@ -283,10 +286,11 @@ procedure add_two() call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); + assume {:captureState "addr:0x76c"}true; return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -385,26 +389,32 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv64; - var Gamma_#1: bool; + var #1: bv64; + var Gamma_#1: bool; lmain: + assume {:captureState "addr:0x600"}true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); + assume {:captureState "addr:0x600"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#1, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#1, 8bv64), Gamma_R30); + assume {:captureState "addr:0x600"}true; R31, Gamma_R31 := #1, Gamma_#1; R29, Gamma_R29 := R31, Gamma_R31; R30, Gamma_R30 := 1548bv64, true; call add_two(); goto l0000027c; l0000027c: + assume {:captureState "addr:0x60c"}true; R30, Gamma_R30 := 1552bv64, true; call add_six(); goto l00000283; l00000283: + assume {:captureState "addr:0x610"}true; R30, Gamma_R30 := 1556bv64, true; call sub_seven(); goto l0000028a; l0000028a: + assume {:captureState "addr:0x614"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -412,7 +422,7 @@ procedure main() return; } -procedure sub_seven() +procedure sub_seven() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 1976bv64) == 1bv8); free requires (memory_load8_le(mem, 1977bv64) == 0bv8); @@ -488,6 +498,7 @@ procedure sub_seven() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lsub_seven: + assume {:captureState "addr:0x790"}true; R1, Gamma_R1 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); @@ -495,5 +506,6 @@ procedure sub_seven() call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); + assume {:captureState "addr:0x79c"}true; return; } diff --git a/src/test/correct/jumptable3/gcc/jumptable3.expected b/src/test/correct/jumptable3/gcc/jumptable3.expected index 45ebc85b1..6f0078804 100644 --- a/src/test/correct/jumptable3/gcc/jumptable3.expected +++ b/src/test/correct/jumptable3/gcc/jumptable3.expected @@ -1,69 +1,69 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"}bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -104,7 +104,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -113,12 +113,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure add_six() +procedure add_six() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 2356bv64) == 1bv8); free requires (memory_load8_le(mem, 2357bv64) == 0bv8); @@ -194,6 +194,7 @@ procedure add_six() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { ladd_six: + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -204,10 +205,11 @@ procedure add_six() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x750"}true; return; } -procedure add_two() +procedure add_two() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 2356bv64) == 1bv8); free requires (memory_load8_le(mem, 2357bv64) == 0bv8); @@ -283,6 +285,7 @@ procedure add_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { ladd_two: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -293,10 +296,11 @@ procedure add_two() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x72c"}true; return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -396,68 +400,73 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #10: bv32; - var #11: bv32; - var #12: bv32; - var #13: bv32; - var #14: bv32; - var #15: bv32; - var #16: bv32; - var #17: bv32; - var #18: bv32; - var #19: bv32; - var #20: bv32; - var #21: bv32; - var #22: bv32; - var #23: bv32; - var #24: bv32; - var #25: bv32; - var #26: bv32; - var #4: bv64; - var #5: bv32; - var #6: bv32; - var #7: bv32; - var #8: bv32; - var #9: bv32; - var CF: bv1; - var Gamma_#10: bool; - var Gamma_#11: bool; - var Gamma_#12: bool; - var Gamma_#13: bool; - var Gamma_#14: bool; - var Gamma_#15: bool; - var Gamma_#16: bool; - var Gamma_#17: bool; - var Gamma_#18: bool; - var Gamma_#19: bool; - var Gamma_#20: bool; - var Gamma_#21: bool; - var Gamma_#22: bool; - var Gamma_#23: bool; - var Gamma_#24: bool; - var Gamma_#25: bool; - var Gamma_#26: bool; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_#7: bool; - var Gamma_#8: bool; - var Gamma_#9: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #10: bv32; + var #11: bv32; + var #12: bv32; + var #13: bv32; + var #14: bv32; + var #15: bv32; + var #16: bv32; + var #17: bv32; + var #18: bv32; + var #19: bv32; + var #20: bv32; + var #21: bv32; + var #22: bv32; + var #23: bv32; + var #24: bv32; + var #25: bv32; + var #26: bv32; + var #4: bv64; + var #5: bv32; + var #6: bv32; + var #7: bv32; + var #8: bv32; + var #9: bv32; + var CF: bv1; + var Gamma_#10: bool; + var Gamma_#11: bool; + var Gamma_#12: bool; + var Gamma_#13: bool; + var Gamma_#14: bool; + var Gamma_#15: bool; + var Gamma_#16: bool; + var Gamma_#17: bool; + var Gamma_#18: bool; + var Gamma_#19: bool; + var Gamma_#20: bool; + var Gamma_#21: bool; + var Gamma_#22: bool; + var Gamma_#23: bool; + var Gamma_#24: bool; + var Gamma_#25: bool; + var Gamma_#26: bool; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_#7: bool; + var Gamma_#8: bool; + var Gamma_#9: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x780"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x780"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x780"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x788"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); + assume {:captureState "addr:0x78c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967284bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934581bv33))), (Gamma_R0 && Gamma_#5); @@ -470,6 +479,7 @@ procedure main() } goto l000005e0; l000005e0: + assume {:captureState "addr:0x79c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967284bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934581bv33))), (Gamma_R0 && Gamma_#6); @@ -482,6 +492,7 @@ procedure main() } goto l00000608; l00000608: + assume {:captureState "addr:0x7a8"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #7, Gamma_#7 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#7); @@ -494,28 +505,35 @@ procedure main() } goto l00000643; l00000629: + assume {:captureState "addr:0x8ec"}true; R30, Gamma_R30 := 2288bv64, true; call sub_seven(); goto l00000635; l00000635: + assume {:captureState "addr:0x8f0"}true; R30, Gamma_R30 := 2292bv64, true; call add_two(); goto l0000063c; l0000063c: + assume {:captureState "addr:0x8f4"}true; R30, Gamma_R30 := 2296bv64, true; call add_six(); goto l00000599; l00000599: + assume {:captureState "addr:0x8f8"}true; R30, Gamma_R30 := 2300bv64, true; call sub_seven(); goto l000005a5; l000005a5: + assume {:captureState "addr:0x8fc"}true; R30, Gamma_R30 := 2304bv64, true; call add_two(); goto l000005ac; l000005ac: + assume {:captureState "addr:0x900"}true; goto l000005ad; l00000643: + assume {:captureState "addr:0x7b4"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #8, Gamma_#8 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#8); @@ -528,6 +546,7 @@ procedure main() } goto l0000066b; l0000066b: + assume {:captureState "addr:0x7c0"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #9, Gamma_#9 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#9); @@ -540,16 +559,20 @@ procedure main() } goto l000006a3; l0000068c: + assume {:captureState "addr:0x8e0"}true; R30, Gamma_R30 := 2276bv64, true; call add_two(); goto l00000698; l00000698: + assume {:captureState "addr:0x8e4"}true; R30, Gamma_R30 := 2280bv64, true; call add_six(); goto l0000069f; l0000069f: + assume {:captureState "addr:0x8e8"}true; goto l000005ad; l000006a3: + assume {:captureState "addr:0x7cc"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #10, Gamma_#10 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#10); @@ -562,6 +585,7 @@ procedure main() } goto l000006cb; l000006cb: + assume {:captureState "addr:0x7d8"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #11, Gamma_#11 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#11); @@ -574,6 +598,7 @@ procedure main() } goto l00000703; l00000703: + assume {:captureState "addr:0x7e4"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #12, Gamma_#12 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#12); @@ -586,6 +611,7 @@ procedure main() } goto l0000072b; l0000072b: + assume {:captureState "addr:0x7f0"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #13, Gamma_#13 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#13, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#13); @@ -598,6 +624,7 @@ procedure main() } goto l00000758; l00000758: + assume {:captureState "addr:0x7fc"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #14, Gamma_#14 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#14, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#14); @@ -610,6 +637,7 @@ procedure main() } goto l00000780; l00000780: + assume {:captureState "addr:0x808"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #15, Gamma_#15 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#15, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#15); @@ -622,6 +650,7 @@ procedure main() } goto l000007ad; l000007ad: + assume {:captureState "addr:0x814"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #16, Gamma_#16 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#16, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#16); @@ -634,6 +663,7 @@ procedure main() } goto l000007d5; l000007d5: + assume {:captureState "addr:0x820"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #17, Gamma_#17 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#17, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#17); @@ -646,32 +676,40 @@ procedure main() } goto l00000809; l000007f6: + assume {:captureState "addr:0x8c4"}true; R30, Gamma_R30 := 2248bv64, true; call add_six(); goto l00000802; l00000802: + assume {:captureState "addr:0x8c8"}true; R30, Gamma_R30 := 2252bv64, true; call add_two(); goto l000007a1; l000007a1: + assume {:captureState "addr:0x8cc"}true; R30, Gamma_R30 := 2256bv64, true; call add_six(); goto l0000074c; l0000074c: + assume {:captureState "addr:0x8d0"}true; R30, Gamma_R30 := 2260bv64, true; call sub_seven(); goto l000006ec; l000006ec: + assume {:captureState "addr:0x8d4"}true; R30, Gamma_R30 := 2264bv64, true; call sub_seven(); goto l000006f8; l000006f8: + assume {:captureState "addr:0x8d8"}true; R30, Gamma_R30 := 2268bv64, true; call add_six(); goto l000006ff; l000006ff: + assume {:captureState "addr:0x8dc"}true; goto l000005ad; l00000809: + assume {:captureState "addr:0x82c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #18, Gamma_#18 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#18, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#18); @@ -684,6 +722,7 @@ procedure main() } goto l00000831; l00000831: + assume {:captureState "addr:0x838"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #19, Gamma_#19 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#19, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#19); @@ -696,12 +735,15 @@ procedure main() } goto l00000862; l00000852: + assume {:captureState "addr:0x8bc"}true; R30, Gamma_R30 := 2240bv64, true; call add_six(); goto l0000085e; l0000085e: + assume {:captureState "addr:0x8c0"}true; goto l000005ad; l00000862: + assume {:captureState "addr:0x844"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #20, Gamma_#20 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#20, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#20); @@ -714,6 +756,7 @@ procedure main() } goto l0000088a; l0000088a: + assume {:captureState "addr:0x850"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #21, Gamma_#21 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#21, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#21); @@ -726,16 +769,20 @@ procedure main() } goto l000008c2; l000008ab: + assume {:captureState "addr:0x8b0"}true; R30, Gamma_R30 := 2228bv64, true; call add_two(); goto l000008b7; l000008b7: + assume {:captureState "addr:0x8b4"}true; R30, Gamma_R30 := 2232bv64, true; call sub_seven(); goto l000008be; l000008be: + assume {:captureState "addr:0x8b8"}true; goto l000005ad; l000008c2: + assume {:captureState "addr:0x85c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #22, Gamma_#22 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#22, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#22); @@ -748,6 +795,7 @@ procedure main() } goto l000008ea; l000008ea: + assume {:captureState "addr:0x868"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #23, Gamma_#23 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#23, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#23); @@ -760,6 +808,7 @@ procedure main() } goto l0000091b; l0000091b: + assume {:captureState "addr:0x874"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #24, Gamma_#24 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#24, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#24); @@ -772,6 +821,7 @@ procedure main() } goto l00000943; l00000943: + assume {:captureState "addr:0x880"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #25, Gamma_#25 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#25, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#25); @@ -784,12 +834,15 @@ procedure main() } goto l0000097b; l00000964: + assume {:captureState "addr:0x89c"}true; R30, Gamma_R30 := 2208bv64, true; call add_two(); goto l00000970; l00000970: + assume {:captureState "addr:0x8a0"}true; goto l000005ad; l0000097b: + assume {:captureState "addr:0x88c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #26, Gamma_#26 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#26, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#26); @@ -802,34 +855,41 @@ procedure main() } goto l000009a1; l00000974: + assume {:captureState "addr:0x8a4"}true; R30, Gamma_R30 := 2216bv64, true; call add_six(); goto l0000090b; l0000090b: + assume {:captureState "addr:0x8a8"}true; R30, Gamma_R30 := 2220bv64, true; call sub_seven(); goto l00000917; l00000917: + assume {:captureState "addr:0x8ac"}true; goto l000005ad; l000005ad: + assume {:captureState "addr:0x90c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); goto l000005c2; l000009a1: + assume {:captureState "addr:0x898"}true; goto l000005d7; l000005d7: + assume {:captureState "addr:0x904"}true; R0, Gamma_R0 := 1bv64, true; goto l000005c2; l000005c2: + assume {:captureState "addr:0x918"}true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; } -procedure sub_seven() +procedure sub_seven() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 2356bv64) == 1bv8); free requires (memory_load8_le(mem, 2357bv64) == 0bv8); @@ -905,6 +965,7 @@ procedure sub_seven() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lsub_seven: + assume {:captureState "addr:0x75c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -915,5 +976,6 @@ procedure sub_seven() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x774"}true; return; } diff --git a/src/test/correct/jumptable3/gcc_O2/jumptable3.expected b/src/test/correct/jumptable3/gcc_O2/jumptable3.expected index ac0f6ba51..f1b44ef8f 100644 --- a/src/test/correct/jumptable3/gcc_O2/jumptable3.expected +++ b/src/test/correct/jumptable3/gcc_O2/jumptable3.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"}bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -80,7 +80,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,12 +89,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -190,35 +190,36 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv32; - var #10: bv32; - var #11: bv32; - var #12: bv32; - var #13: bv32; - var #5: bv32; - var #6: bv32; - var #7: bv32; - var #8: bv32; - var #9: bv32; - var CF: bv1; - var Gamma_#1: bool; - var Gamma_#10: bool; - var Gamma_#11: bool; - var Gamma_#12: bool; - var Gamma_#13: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_#7: bool; - var Gamma_#8: bool; - var Gamma_#9: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #1: bv32; + var #10: bv32; + var #11: bv32; + var #12: bv32; + var #13: bv32; + var #5: bv32; + var #6: bv32; + var #7: bv32; + var #8: bv32; + var #9: bv32; + var CF: bv1; + var Gamma_#1: bool; + var Gamma_#10: bool; + var Gamma_#11: bool; + var Gamma_#12: bool; + var Gamma_#13: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_#7: bool; + var Gamma_#8: bool; + var Gamma_#9: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; #1, Gamma_#1 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#1, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#1); @@ -231,12 +232,14 @@ procedure main() } goto l00000753; l00000753: + assume {:captureState "addr:0x60c"}true; assert (Gamma_ZF && (Gamma_VF && Gamma_NF)); if ((bvand1(bvcomp1(NF, VF), bvcomp1(ZF, 0bv1)) != 0bv1)) { goto l000006e8; } goto l0000075c; l000006e8: + assume {:captureState "addr:0x688"}true; R1, Gamma_R1 := 69632bv64, true; #8, Gamma_#8 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#8); @@ -249,20 +252,24 @@ procedure main() } goto l0000070c; l000005f9: + assume {:captureState "addr:0x710"}true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 8bv32)), Gamma_R0; call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; goto l00000360; l0000070c: + assume {:captureState "addr:0x694"}true; assert (Gamma_ZF && (Gamma_VF && Gamma_NF)); if ((bvnot1(bvand1(bvcomp1(NF, VF), bvcomp1(ZF, 0bv1))) != 0bv1)) { goto l00000644; } goto l00000715; l00000644: + assume {:captureState "addr:0x6b8"}true; #6, Gamma_#6 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#6); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#6, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967289bv33))), (Gamma_R0 && Gamma_#6); @@ -274,6 +281,7 @@ procedure main() } goto l00000663; l00000663: + assume {:captureState "addr:0x6c0"}true; #7, Gamma_#7 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#7); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#7, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967288bv33))), (Gamma_R0 && Gamma_#7); @@ -285,6 +293,7 @@ procedure main() } goto l00000347; l00000715: + assume {:captureState "addr:0x698"}true; #9, Gamma_#9 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#9); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#9, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967286bv33))), (Gamma_R0 && Gamma_#9); @@ -296,14 +305,17 @@ procedure main() } goto l00000734; l00000612: + assume {:captureState "addr:0x720"}true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 1bv32)), Gamma_R0; call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); + assume {:captureState "addr:0x728"}true; goto l00000628; l00000734: + assume {:captureState "addr:0x6a0"}true; #10, Gamma_#10 := bvadd32(R0[32:0], 4294967284bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934581bv33))), (Gamma_R0 && Gamma_#10); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#10, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967285bv33))), (Gamma_R0 && Gamma_#10); @@ -315,14 +327,17 @@ procedure main() } goto l00000628; l00000628: + assume {:captureState "addr:0x6a8"}true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 4294967291bv32)), Gamma_R0; call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); + assume {:captureState "addr:0x6b0"}true; goto l00000360; l0000075c: + assume {:captureState "addr:0x610"}true; #11, Gamma_#11 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#11); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#11, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967293bv33))), (Gamma_R0 && Gamma_#11); @@ -334,6 +349,7 @@ procedure main() } goto l0000077b; l0000069c: + assume {:captureState "addr:0x6d8"}true; R1, Gamma_R1 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); @@ -341,14 +357,17 @@ procedure main() call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); + assume {:captureState "addr:0x6e4"}true; goto l00000360; l0000077b: + assume {:captureState "addr:0x618"}true; assert (Gamma_ZF && (Gamma_VF && Gamma_NF)); if ((bvand1(bvcomp1(NF, VF), bvcomp1(ZF, 0bv1)) != 0bv1)) { goto l000005bc; } goto l00000784; l000005bc: + assume {:captureState "addr:0x654"}true; #5, Gamma_#5 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#5); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#5, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967292bv33))), (Gamma_R0 && Gamma_#5); @@ -360,6 +379,7 @@ procedure main() } goto l00000682; l000005d6: + assume {:captureState "addr:0x6fc"}true; R1, Gamma_R1 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); @@ -367,8 +387,10 @@ procedure main() call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); + assume {:captureState "addr:0x708"}true; goto l00000360; l00000682: + assume {:captureState "addr:0x65c"}true; R1, Gamma_R1 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); @@ -376,32 +398,40 @@ procedure main() call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); + assume {:captureState "addr:0x668"}true; goto l00000317; l00000317: + assume {:captureState "addr:0x66c"}true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 6bv32)), Gamma_R0; call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); + assume {:captureState "addr:0x674"}true; goto l00000331; l00000331: + assume {:captureState "addr:0x678"}true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 4294967289bv32)), Gamma_R0; call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); + assume {:captureState "addr:0x680"}true; goto l00000347; l00000347: + assume {:captureState "addr:0x6c8"}true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 4294967295bv32)), Gamma_R0; call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); + assume {:captureState "addr:0x6d0"}true; goto l00000360; l00000784: + assume {:captureState "addr:0x61c"}true; R1, Gamma_R1 := 69632bv64, true; #12, Gamma_#12 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#12); @@ -414,14 +444,17 @@ procedure main() } goto l000007a8; l000006ba: + assume {:captureState "addr:0x6ec"}true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 6bv32)), Gamma_R0; call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); + assume {:captureState "addr:0x6f4"}true; goto l000006d0; l000007a8: + assume {:captureState "addr:0x628"}true; #13, Gamma_#13 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#13, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#13); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#13, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967294bv33))), (Gamma_R0 && Gamma_#13); @@ -433,30 +466,37 @@ procedure main() } goto l000006d0; l00000368: + assume {:captureState "addr:0x640"}true; assert Gamma_R0; if ((bvnot1(bvcomp32(R0[32:0], 0bv32)) != 0bv1)) { goto l0000036b; } goto l000005a3; l0000036b: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 1bv64, true; return; l000005a3: + assume {:captureState "addr:0x644"}true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 2bv32)), Gamma_R0; call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); + assume {:captureState "addr:0x64c"}true; goto l00000360; l000006d0: + assume {:captureState "addr:0x630"}true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 4294967289bv32)), Gamma_R0; call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); + assume {:captureState "addr:0x638"}true; goto l00000360; l00000360: + assume {:captureState "addr:0x63c"}true; return; } diff --git a/src/test/correct/jumptable3/gcc_no_plt_no_pic/jumptable3.expected b/src/test/correct/jumptable3/gcc_no_plt_no_pic/jumptable3.expected index 1bd68c2f8..c8c1c38f9 100644 --- a/src/test/correct/jumptable3/gcc_no_plt_no_pic/jumptable3.expected +++ b/src/test/correct/jumptable3/gcc_no_plt_no_pic/jumptable3.expected @@ -1,69 +1,69 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"}bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -104,7 +104,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -113,12 +113,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure add_six() +procedure add_six() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 2356bv64) == 1bv8); free requires (memory_load8_le(mem, 2357bv64) == 0bv8); @@ -194,6 +194,7 @@ procedure add_six() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { ladd_six: + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -204,10 +205,11 @@ procedure add_six() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x750"}true; return; } -procedure add_two() +procedure add_two() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 2356bv64) == 1bv8); free requires (memory_load8_le(mem, 2357bv64) == 0bv8); @@ -283,6 +285,7 @@ procedure add_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { ladd_two: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -293,10 +296,11 @@ procedure add_two() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x72c"}true; return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -396,68 +400,73 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #10: bv32; - var #11: bv32; - var #12: bv32; - var #13: bv32; - var #14: bv32; - var #15: bv32; - var #16: bv32; - var #17: bv32; - var #18: bv32; - var #19: bv32; - var #20: bv32; - var #21: bv32; - var #22: bv32; - var #23: bv32; - var #24: bv32; - var #25: bv32; - var #26: bv32; - var #4: bv64; - var #5: bv32; - var #6: bv32; - var #7: bv32; - var #8: bv32; - var #9: bv32; - var CF: bv1; - var Gamma_#10: bool; - var Gamma_#11: bool; - var Gamma_#12: bool; - var Gamma_#13: bool; - var Gamma_#14: bool; - var Gamma_#15: bool; - var Gamma_#16: bool; - var Gamma_#17: bool; - var Gamma_#18: bool; - var Gamma_#19: bool; - var Gamma_#20: bool; - var Gamma_#21: bool; - var Gamma_#22: bool; - var Gamma_#23: bool; - var Gamma_#24: bool; - var Gamma_#25: bool; - var Gamma_#26: bool; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_#7: bool; - var Gamma_#8: bool; - var Gamma_#9: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #10: bv32; + var #11: bv32; + var #12: bv32; + var #13: bv32; + var #14: bv32; + var #15: bv32; + var #16: bv32; + var #17: bv32; + var #18: bv32; + var #19: bv32; + var #20: bv32; + var #21: bv32; + var #22: bv32; + var #23: bv32; + var #24: bv32; + var #25: bv32; + var #26: bv32; + var #4: bv64; + var #5: bv32; + var #6: bv32; + var #7: bv32; + var #8: bv32; + var #9: bv32; + var CF: bv1; + var Gamma_#10: bool; + var Gamma_#11: bool; + var Gamma_#12: bool; + var Gamma_#13: bool; + var Gamma_#14: bool; + var Gamma_#15: bool; + var Gamma_#16: bool; + var Gamma_#17: bool; + var Gamma_#18: bool; + var Gamma_#19: bool; + var Gamma_#20: bool; + var Gamma_#21: bool; + var Gamma_#22: bool; + var Gamma_#23: bool; + var Gamma_#24: bool; + var Gamma_#25: bool; + var Gamma_#26: bool; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_#7: bool; + var Gamma_#8: bool; + var Gamma_#9: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x780"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x780"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x780"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x788"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); + assume {:captureState "addr:0x78c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967284bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934581bv33))), (Gamma_R0 && Gamma_#5); @@ -470,6 +479,7 @@ procedure main() } goto l0000133b; l0000133b: + assume {:captureState "addr:0x79c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967284bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934581bv33))), (Gamma_R0 && Gamma_#6); @@ -482,6 +492,7 @@ procedure main() } goto l00001363; l00001363: + assume {:captureState "addr:0x7a8"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #7, Gamma_#7 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#7); @@ -494,28 +505,35 @@ procedure main() } goto l0000139e; l00001384: + assume {:captureState "addr:0x8ec"}true; R30, Gamma_R30 := 2288bv64, true; call sub_seven(); goto l00001390; l00001390: + assume {:captureState "addr:0x8f0"}true; R30, Gamma_R30 := 2292bv64, true; call add_two(); goto l00001397; l00001397: + assume {:captureState "addr:0x8f4"}true; R30, Gamma_R30 := 2296bv64, true; call add_six(); goto l000012f4; l000012f4: + assume {:captureState "addr:0x8f8"}true; R30, Gamma_R30 := 2300bv64, true; call sub_seven(); goto l00001300; l00001300: + assume {:captureState "addr:0x8fc"}true; R30, Gamma_R30 := 2304bv64, true; call add_two(); goto l00001307; l00001307: + assume {:captureState "addr:0x900"}true; goto l00001308; l0000139e: + assume {:captureState "addr:0x7b4"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #8, Gamma_#8 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#8); @@ -528,6 +546,7 @@ procedure main() } goto l000013c6; l000013c6: + assume {:captureState "addr:0x7c0"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #9, Gamma_#9 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#9); @@ -540,16 +559,20 @@ procedure main() } goto l000013fe; l000013e7: + assume {:captureState "addr:0x8e0"}true; R30, Gamma_R30 := 2276bv64, true; call add_two(); goto l000013f3; l000013f3: + assume {:captureState "addr:0x8e4"}true; R30, Gamma_R30 := 2280bv64, true; call add_six(); goto l000013fa; l000013fa: + assume {:captureState "addr:0x8e8"}true; goto l00001308; l000013fe: + assume {:captureState "addr:0x7cc"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #10, Gamma_#10 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#10); @@ -562,6 +585,7 @@ procedure main() } goto l00001426; l00001426: + assume {:captureState "addr:0x7d8"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #11, Gamma_#11 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#11); @@ -574,6 +598,7 @@ procedure main() } goto l0000145e; l0000145e: + assume {:captureState "addr:0x7e4"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #12, Gamma_#12 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#12); @@ -586,6 +611,7 @@ procedure main() } goto l00001486; l00001486: + assume {:captureState "addr:0x7f0"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #13, Gamma_#13 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#13, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#13); @@ -598,6 +624,7 @@ procedure main() } goto l000014b3; l000014b3: + assume {:captureState "addr:0x7fc"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #14, Gamma_#14 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#14, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#14); @@ -610,6 +637,7 @@ procedure main() } goto l000014db; l000014db: + assume {:captureState "addr:0x808"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #15, Gamma_#15 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#15, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#15); @@ -622,6 +650,7 @@ procedure main() } goto l00001508; l00001508: + assume {:captureState "addr:0x814"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #16, Gamma_#16 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#16, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#16); @@ -634,6 +663,7 @@ procedure main() } goto l00001530; l00001530: + assume {:captureState "addr:0x820"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #17, Gamma_#17 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#17, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#17); @@ -646,32 +676,40 @@ procedure main() } goto l00001564; l00001551: + assume {:captureState "addr:0x8c4"}true; R30, Gamma_R30 := 2248bv64, true; call add_six(); goto l0000155d; l0000155d: + assume {:captureState "addr:0x8c8"}true; R30, Gamma_R30 := 2252bv64, true; call add_two(); goto l000014fc; l000014fc: + assume {:captureState "addr:0x8cc"}true; R30, Gamma_R30 := 2256bv64, true; call add_six(); goto l000014a7; l000014a7: + assume {:captureState "addr:0x8d0"}true; R30, Gamma_R30 := 2260bv64, true; call sub_seven(); goto l00001447; l00001447: + assume {:captureState "addr:0x8d4"}true; R30, Gamma_R30 := 2264bv64, true; call sub_seven(); goto l00001453; l00001453: + assume {:captureState "addr:0x8d8"}true; R30, Gamma_R30 := 2268bv64, true; call add_six(); goto l0000145a; l0000145a: + assume {:captureState "addr:0x8dc"}true; goto l00001308; l00001564: + assume {:captureState "addr:0x82c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #18, Gamma_#18 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#18, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#18); @@ -684,6 +722,7 @@ procedure main() } goto l0000158c; l0000158c: + assume {:captureState "addr:0x838"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #19, Gamma_#19 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#19, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#19); @@ -696,12 +735,15 @@ procedure main() } goto l000015bd; l000015ad: + assume {:captureState "addr:0x8bc"}true; R30, Gamma_R30 := 2240bv64, true; call add_six(); goto l000015b9; l000015b9: + assume {:captureState "addr:0x8c0"}true; goto l00001308; l000015bd: + assume {:captureState "addr:0x844"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #20, Gamma_#20 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#20, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#20); @@ -714,6 +756,7 @@ procedure main() } goto l000015e5; l000015e5: + assume {:captureState "addr:0x850"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #21, Gamma_#21 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#21, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#21); @@ -726,16 +769,20 @@ procedure main() } goto l0000161d; l00001606: + assume {:captureState "addr:0x8b0"}true; R30, Gamma_R30 := 2228bv64, true; call add_two(); goto l00001612; l00001612: + assume {:captureState "addr:0x8b4"}true; R30, Gamma_R30 := 2232bv64, true; call sub_seven(); goto l00001619; l00001619: + assume {:captureState "addr:0x8b8"}true; goto l00001308; l0000161d: + assume {:captureState "addr:0x85c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #22, Gamma_#22 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#22, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#22); @@ -748,6 +795,7 @@ procedure main() } goto l00001645; l00001645: + assume {:captureState "addr:0x868"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #23, Gamma_#23 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#23, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#23); @@ -760,6 +808,7 @@ procedure main() } goto l00001676; l00001676: + assume {:captureState "addr:0x874"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #24, Gamma_#24 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#24, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#24); @@ -772,6 +821,7 @@ procedure main() } goto l0000169e; l0000169e: + assume {:captureState "addr:0x880"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #25, Gamma_#25 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#25, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#25); @@ -784,12 +834,15 @@ procedure main() } goto l000016d6; l000016bf: + assume {:captureState "addr:0x89c"}true; R30, Gamma_R30 := 2208bv64, true; call add_two(); goto l000016cb; l000016cb: + assume {:captureState "addr:0x8a0"}true; goto l00001308; l000016d6: + assume {:captureState "addr:0x88c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #26, Gamma_#26 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#26, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#26); @@ -802,34 +855,41 @@ procedure main() } goto l000016fc; l000016cf: + assume {:captureState "addr:0x8a4"}true; R30, Gamma_R30 := 2216bv64, true; call add_six(); goto l00001666; l00001666: + assume {:captureState "addr:0x8a8"}true; R30, Gamma_R30 := 2220bv64, true; call sub_seven(); goto l00001672; l00001672: + assume {:captureState "addr:0x8ac"}true; goto l00001308; l00001308: + assume {:captureState "addr:0x90c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); goto l0000131d; l000016fc: + assume {:captureState "addr:0x898"}true; goto l00001332; l00001332: + assume {:captureState "addr:0x904"}true; R0, Gamma_R0 := 1bv64, true; goto l0000131d; l0000131d: + assume {:captureState "addr:0x918"}true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; } -procedure sub_seven() +procedure sub_seven() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 2356bv64) == 1bv8); free requires (memory_load8_le(mem, 2357bv64) == 0bv8); @@ -905,6 +965,7 @@ procedure sub_seven() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lsub_seven: + assume {:captureState "addr:0x75c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -915,5 +976,6 @@ procedure sub_seven() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x774"}true; return; } diff --git a/src/test/correct/jumptable3/gcc_pic/jumptable3.expected b/src/test/correct/jumptable3/gcc_pic/jumptable3.expected index 8192e9efc..98d58c4b2 100644 --- a/src/test/correct/jumptable3/gcc_pic/jumptable3.expected +++ b/src/test/correct/jumptable3/gcc_pic/jumptable3.expected @@ -1,69 +1,69 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"}bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -112,7 +112,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -121,12 +121,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure add_six() +procedure add_six() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 2420bv64) == 1bv8); free requires (memory_load8_le(mem, 2421bv64) == 0bv8); @@ -218,6 +218,7 @@ procedure add_six() free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { ladd_six: + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -230,10 +231,11 @@ procedure add_six() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x790"}true; return; } -procedure add_two() +procedure add_two() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 2420bv64) == 1bv8); free requires (memory_load8_le(mem, 2421bv64) == 0bv8); @@ -325,6 +327,7 @@ procedure add_two() free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { ladd_two: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -337,10 +340,11 @@ procedure add_two() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x76c"}true; return; } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R29, R30, R31, mem, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -456,68 +460,73 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var #10: bv32; - var #11: bv32; - var #12: bv32; - var #13: bv32; - var #14: bv32; - var #15: bv32; - var #16: bv32; - var #17: bv32; - var #18: bv32; - var #19: bv32; - var #20: bv32; - var #21: bv32; - var #22: bv32; - var #23: bv32; - var #24: bv32; - var #25: bv32; - var #26: bv32; - var #4: bv64; - var #5: bv32; - var #6: bv32; - var #7: bv32; - var #8: bv32; - var #9: bv32; - var CF: bv1; - var Gamma_#10: bool; - var Gamma_#11: bool; - var Gamma_#12: bool; - var Gamma_#13: bool; - var Gamma_#14: bool; - var Gamma_#15: bool; - var Gamma_#16: bool; - var Gamma_#17: bool; - var Gamma_#18: bool; - var Gamma_#19: bool; - var Gamma_#20: bool; - var Gamma_#21: bool; - var Gamma_#22: bool; - var Gamma_#23: bool; - var Gamma_#24: bool; - var Gamma_#25: bool; - var Gamma_#26: bool; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_#7: bool; - var Gamma_#8: bool; - var Gamma_#9: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #10: bv32; + var #11: bv32; + var #12: bv32; + var #13: bv32; + var #14: bv32; + var #15: bv32; + var #16: bv32; + var #17: bv32; + var #18: bv32; + var #19: bv32; + var #20: bv32; + var #21: bv32; + var #22: bv32; + var #23: bv32; + var #24: bv32; + var #25: bv32; + var #26: bv32; + var #4: bv64; + var #5: bv32; + var #6: bv32; + var #7: bv32; + var #8: bv32; + var #9: bv32; + var CF: bv1; + var Gamma_#10: bool; + var Gamma_#11: bool; + var Gamma_#12: bool; + var Gamma_#13: bool; + var Gamma_#14: bool; + var Gamma_#15: bool; + var Gamma_#16: bool; + var Gamma_#17: bool; + var Gamma_#18: bool; + var Gamma_#19: bool; + var Gamma_#20: bool; + var Gamma_#21: bool; + var Gamma_#22: bool; + var Gamma_#23: bool; + var Gamma_#24: bool; + var Gamma_#25: bool; + var Gamma_#26: bool; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_#7: bool; + var Gamma_#8: bool; + var Gamma_#9: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x7c0"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x7c0"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x7c0"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x7c8"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); + assume {:captureState "addr:0x7cc"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967284bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934581bv33))), (Gamma_R0 && Gamma_#5); @@ -530,6 +539,7 @@ procedure main() } goto l000005e7; l000005e7: + assume {:captureState "addr:0x7dc"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967284bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934581bv33))), (Gamma_R0 && Gamma_#6); @@ -542,6 +552,7 @@ procedure main() } goto l0000060f; l0000060f: + assume {:captureState "addr:0x7e8"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #7, Gamma_#7 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#7); @@ -554,28 +565,35 @@ procedure main() } goto l0000064a; l00000630: + assume {:captureState "addr:0x92c"}true; R30, Gamma_R30 := 2352bv64, true; call sub_seven(); goto l0000063c; l0000063c: + assume {:captureState "addr:0x930"}true; R30, Gamma_R30 := 2356bv64, true; call add_two(); goto l00000643; l00000643: + assume {:captureState "addr:0x934"}true; R30, Gamma_R30 := 2360bv64, true; call add_six(); goto l0000059f; l0000059f: + assume {:captureState "addr:0x938"}true; R30, Gamma_R30 := 2364bv64, true; call sub_seven(); goto l000005ab; l000005ab: + assume {:captureState "addr:0x93c"}true; R30, Gamma_R30 := 2368bv64, true; call add_two(); goto l000005b2; l000005b2: + assume {:captureState "addr:0x940"}true; goto l000005b3; l0000064a: + assume {:captureState "addr:0x7f4"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #8, Gamma_#8 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#8); @@ -588,6 +606,7 @@ procedure main() } goto l00000672; l00000672: + assume {:captureState "addr:0x800"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #9, Gamma_#9 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#9); @@ -600,16 +619,20 @@ procedure main() } goto l000006aa; l00000693: + assume {:captureState "addr:0x920"}true; R30, Gamma_R30 := 2340bv64, true; call add_two(); goto l0000069f; l0000069f: + assume {:captureState "addr:0x924"}true; R30, Gamma_R30 := 2344bv64, true; call add_six(); goto l000006a6; l000006a6: + assume {:captureState "addr:0x928"}true; goto l000005b3; l000006aa: + assume {:captureState "addr:0x80c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #10, Gamma_#10 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#10); @@ -622,6 +645,7 @@ procedure main() } goto l000006d2; l000006d2: + assume {:captureState "addr:0x818"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #11, Gamma_#11 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#11); @@ -634,6 +658,7 @@ procedure main() } goto l0000070a; l0000070a: + assume {:captureState "addr:0x824"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #12, Gamma_#12 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#12); @@ -646,6 +671,7 @@ procedure main() } goto l00000732; l00000732: + assume {:captureState "addr:0x830"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #13, Gamma_#13 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#13, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#13); @@ -658,6 +684,7 @@ procedure main() } goto l0000075f; l0000075f: + assume {:captureState "addr:0x83c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #14, Gamma_#14 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#14, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#14); @@ -670,6 +697,7 @@ procedure main() } goto l00000787; l00000787: + assume {:captureState "addr:0x848"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #15, Gamma_#15 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#15, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#15); @@ -682,6 +710,7 @@ procedure main() } goto l000007b4; l000007b4: + assume {:captureState "addr:0x854"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #16, Gamma_#16 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#16, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#16); @@ -694,6 +723,7 @@ procedure main() } goto l000007dc; l000007dc: + assume {:captureState "addr:0x860"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #17, Gamma_#17 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#17, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#17); @@ -706,32 +736,40 @@ procedure main() } goto l00000810; l000007fd: + assume {:captureState "addr:0x904"}true; R30, Gamma_R30 := 2312bv64, true; call add_six(); goto l00000809; l00000809: + assume {:captureState "addr:0x908"}true; R30, Gamma_R30 := 2316bv64, true; call add_two(); goto l000007a8; l000007a8: + assume {:captureState "addr:0x90c"}true; R30, Gamma_R30 := 2320bv64, true; call add_six(); goto l00000753; l00000753: + assume {:captureState "addr:0x910"}true; R30, Gamma_R30 := 2324bv64, true; call sub_seven(); goto l000006f3; l000006f3: + assume {:captureState "addr:0x914"}true; R30, Gamma_R30 := 2328bv64, true; call sub_seven(); goto l000006ff; l000006ff: + assume {:captureState "addr:0x918"}true; R30, Gamma_R30 := 2332bv64, true; call add_six(); goto l00000706; l00000706: + assume {:captureState "addr:0x91c"}true; goto l000005b3; l00000810: + assume {:captureState "addr:0x86c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #18, Gamma_#18 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#18, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#18); @@ -744,6 +782,7 @@ procedure main() } goto l00000838; l00000838: + assume {:captureState "addr:0x878"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #19, Gamma_#19 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#19, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#19); @@ -756,12 +795,15 @@ procedure main() } goto l00000869; l00000859: + assume {:captureState "addr:0x8fc"}true; R30, Gamma_R30 := 2304bv64, true; call add_six(); goto l00000865; l00000865: + assume {:captureState "addr:0x900"}true; goto l000005b3; l00000869: + assume {:captureState "addr:0x884"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #20, Gamma_#20 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#20, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#20); @@ -774,6 +816,7 @@ procedure main() } goto l00000891; l00000891: + assume {:captureState "addr:0x890"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #21, Gamma_#21 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#21, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#21); @@ -786,16 +829,20 @@ procedure main() } goto l000008c9; l000008b2: + assume {:captureState "addr:0x8f0"}true; R30, Gamma_R30 := 2292bv64, true; call add_two(); goto l000008be; l000008be: + assume {:captureState "addr:0x8f4"}true; R30, Gamma_R30 := 2296bv64, true; call sub_seven(); goto l000008c5; l000008c5: + assume {:captureState "addr:0x8f8"}true; goto l000005b3; l000008c9: + assume {:captureState "addr:0x89c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #22, Gamma_#22 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#22, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#22); @@ -808,6 +855,7 @@ procedure main() } goto l000008f1; l000008f1: + assume {:captureState "addr:0x8a8"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #23, Gamma_#23 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#23, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#23); @@ -820,6 +868,7 @@ procedure main() } goto l00000922; l00000922: + assume {:captureState "addr:0x8b4"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #24, Gamma_#24 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#24, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#24); @@ -832,6 +881,7 @@ procedure main() } goto l0000094a; l0000094a: + assume {:captureState "addr:0x8c0"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #25, Gamma_#25 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#25, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#25); @@ -844,12 +894,15 @@ procedure main() } goto l00000982; l0000096b: + assume {:captureState "addr:0x8dc"}true; R30, Gamma_R30 := 2272bv64, true; call add_two(); goto l00000977; l00000977: + assume {:captureState "addr:0x8e0"}true; goto l000005b3; l00000982: + assume {:captureState "addr:0x8cc"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #26, Gamma_#26 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#26, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#26); @@ -862,16 +915,20 @@ procedure main() } goto l000009a8; l0000097b: + assume {:captureState "addr:0x8e4"}true; R30, Gamma_R30 := 2280bv64, true; call add_six(); goto l00000912; l00000912: + assume {:captureState "addr:0x8e8"}true; R30, Gamma_R30 := 2284bv64, true; call sub_seven(); goto l0000091e; l0000091e: + assume {:captureState "addr:0x8ec"}true; goto l000005b3; l000005b3: + assume {:captureState "addr:0x94c"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -879,18 +936,21 @@ procedure main() R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); goto l000005c9; l000009a8: + assume {:captureState "addr:0x8d8"}true; goto l000005de; l000005de: + assume {:captureState "addr:0x944"}true; R0, Gamma_R0 := 1bv64, true; goto l000005c9; l000005c9: + assume {:captureState "addr:0x958"}true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; } -procedure sub_seven() +procedure sub_seven() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 2420bv64) == 1bv8); free requires (memory_load8_le(mem, 2421bv64) == 0bv8); @@ -982,6 +1042,7 @@ procedure sub_seven() free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { lsub_seven: + assume {:captureState "addr:0x79c"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -994,5 +1055,6 @@ procedure sub_seven() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x7b4"}true; return; } diff --git a/src/test/correct/malloc_with_local/clang/malloc_with_local.expected b/src/test/correct/malloc_with_local/clang/malloc_with_local.expected index 567a3ba00..1883bb73b 100644 --- a/src/test/correct/malloc_with_local/clang/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/clang/malloc_with_local.expected @@ -1,83 +1,83 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2256bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2256bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,12 +187,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2256bv64) == 1bv8); free requires (memory_load8_le(mem, 2257bv64) == 0bv8); @@ -387,7 +387,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -602,43 +602,55 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x818"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x818"}true; R29, Gamma_R29 := bvadd64(R31, 32bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, R31, R8[32:0]), gamma_store32(Gamma_stack, R31, Gamma_R8); + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); + assume {:captureState "addr:0x828"}true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000391; l00000391: + assume {:captureState "addr:0x834"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); + assume {:captureState "addr:0x834"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2112bv64, true; call malloc(); goto l000003a5; l000003a5: + assume {:captureState "addr:0x840"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x840"}true; R8, Gamma_R8 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x848"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x854"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x860"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -648,6 +660,7 @@ procedure main() call printf(); goto l00000403; l00000403: + assume {:captureState "addr:0x878"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -657,6 +670,7 @@ procedure main() call printf(); goto l00000423; l00000423: + assume {:captureState "addr:0x88c"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2293bv64), Gamma_R0; @@ -664,16 +678,19 @@ procedure main() call printf(); goto l0000043c; l0000043c: + assume {:captureState "addr:0x89c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2212bv64, true; call #free(); goto l0000044b; l0000044b: + assume {:captureState "addr:0x8a4"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2220bv64, true; call #free(); goto l00000459; l00000459: + assume {:captureState "addr:0x8ac"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, R31)), gamma_load32(Gamma_stack, R31); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -682,7 +699,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2256bv64) == 1bv8); free requires (memory_load8_le(mem, 2257bv64) == 0bv8); @@ -877,7 +894,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2256bv64) == 1bv8); free requires (memory_load8_le(mem, 2257bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local/clang_O2/malloc_with_local.expected b/src/test/correct/malloc_with_local/clang_O2/malloc_with_local.expected index 2989a2ee6..9d23a723c 100644 --- a/src/test/correct/malloc_with_local/clang_O2/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/clang_O2/malloc_with_local.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1964bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1964bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -140,7 +140,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -149,12 +149,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -369,12 +369,15 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x754"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x754"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 0bv64, true; @@ -384,6 +387,7 @@ procedure main() call printf(); goto l00000322; l00000322: + assume {:captureState "addr:0x76c"}true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 1985bv64), Gamma_R0; R1, Gamma_R1 := 42bv64, true; @@ -391,6 +395,7 @@ procedure main() call printf(); goto l00000339; l00000339: + assume {:captureState "addr:0x77c"}true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2001bv64), Gamma_R0; R1, Gamma_R1 := 10bv64, true; @@ -398,6 +403,7 @@ procedure main() call printf(); goto l00000350; l00000350: + assume {:captureState "addr:0x78c"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -405,7 +411,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1964bv64) == 1bv8); free requires (memory_load8_le(mem, 1965bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local/clang_no_plt_no_pic/malloc_with_local.expected b/src/test/correct/malloc_with_local/clang_no_plt_no_pic/malloc_with_local.expected index c915c2f6f..4ebaee775 100644 --- a/src/test/correct/malloc_with_local/clang_no_plt_no_pic/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/clang_no_plt_no_pic/malloc_with_local.expected @@ -1,83 +1,83 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2256bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2256bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,12 +187,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2256bv64) == 1bv8); free requires (memory_load8_le(mem, 2257bv64) == 0bv8); @@ -387,7 +387,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -602,43 +602,55 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x818"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x818"}true; R29, Gamma_R29 := bvadd64(R31, 32bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, R31, R8[32:0]), gamma_store32(Gamma_stack, R31, Gamma_R8); + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); + assume {:captureState "addr:0x828"}true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000b03; l00000b03: + assume {:captureState "addr:0x834"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); + assume {:captureState "addr:0x834"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2112bv64, true; call malloc(); goto l00000b17; l00000b17: + assume {:captureState "addr:0x840"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x840"}true; R8, Gamma_R8 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x848"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x854"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x860"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -648,6 +660,7 @@ procedure main() call printf(); goto l00000b75; l00000b75: + assume {:captureState "addr:0x878"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -657,6 +670,7 @@ procedure main() call printf(); goto l00000b95; l00000b95: + assume {:captureState "addr:0x88c"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2293bv64), Gamma_R0; @@ -664,16 +678,19 @@ procedure main() call printf(); goto l00000bae; l00000bae: + assume {:captureState "addr:0x89c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2212bv64, true; call #free(); goto l00000bbd; l00000bbd: + assume {:captureState "addr:0x8a4"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2220bv64, true; call #free(); goto l00000bcb; l00000bcb: + assume {:captureState "addr:0x8ac"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, R31)), gamma_load32(Gamma_stack, R31); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -682,7 +699,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2256bv64) == 1bv8); free requires (memory_load8_le(mem, 2257bv64) == 0bv8); @@ -877,7 +894,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2256bv64) == 1bv8); free requires (memory_load8_le(mem, 2257bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local/clang_pic/malloc_with_local.expected b/src/test/correct/malloc_with_local/clang_pic/malloc_with_local.expected index c915c2f6f..4ebaee775 100644 --- a/src/test/correct/malloc_with_local/clang_pic/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/clang_pic/malloc_with_local.expected @@ -1,83 +1,83 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2256bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2256bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,12 +187,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2256bv64) == 1bv8); free requires (memory_load8_le(mem, 2257bv64) == 0bv8); @@ -387,7 +387,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -602,43 +602,55 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x818"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x818"}true; R29, Gamma_R29 := bvadd64(R31, 32bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, R31, R8[32:0]), gamma_store32(Gamma_stack, R31, Gamma_R8); + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); + assume {:captureState "addr:0x828"}true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000b03; l00000b03: + assume {:captureState "addr:0x834"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); + assume {:captureState "addr:0x834"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2112bv64, true; call malloc(); goto l00000b17; l00000b17: + assume {:captureState "addr:0x840"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x840"}true; R8, Gamma_R8 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x848"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x854"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x860"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -648,6 +660,7 @@ procedure main() call printf(); goto l00000b75; l00000b75: + assume {:captureState "addr:0x878"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -657,6 +670,7 @@ procedure main() call printf(); goto l00000b95; l00000b95: + assume {:captureState "addr:0x88c"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2293bv64), Gamma_R0; @@ -664,16 +678,19 @@ procedure main() call printf(); goto l00000bae; l00000bae: + assume {:captureState "addr:0x89c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2212bv64, true; call #free(); goto l00000bbd; l00000bbd: + assume {:captureState "addr:0x8a4"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2220bv64, true; call #free(); goto l00000bcb; l00000bcb: + assume {:captureState "addr:0x8ac"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, R31)), gamma_load32(Gamma_stack, R31); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -682,7 +699,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2256bv64) == 1bv8); free requires (memory_load8_le(mem, 2257bv64) == 0bv8); @@ -877,7 +894,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2256bv64) == 1bv8); free requires (memory_load8_le(mem, 2257bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local/gcc/malloc_with_local.expected b/src/test/correct/malloc_with_local/gcc/malloc_with_local.expected index 4e2c75782..c8c8180d9 100644 --- a/src/test/correct/malloc_with_local/gcc/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/gcc/malloc_with_local.expected @@ -1,79 +1,79 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2248bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2248bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,12 +194,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2248bv64) == 1bv8); free requires (memory_load8_le(mem, 2249bv64) == 0bv8); @@ -416,7 +416,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -653,12 +653,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x814"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x814"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -666,25 +669,32 @@ procedure main() call malloc(); goto l0000036f; l0000036f: + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); + assume {:captureState "addr:0x824"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2096bv64, true; call malloc(); goto l00000383; l00000383: + assume {:captureState "addr:0x830"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); + assume {:captureState "addr:0x830"}true; R0, Gamma_R0 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x838"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x844"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x850"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -695,6 +705,7 @@ procedure main() call printf(); goto l000003e7; l000003e7: + assume {:captureState "addr:0x86c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -705,6 +716,7 @@ procedure main() call printf(); goto l0000040d; l0000040d: + assume {:captureState "addr:0x884"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2296bv64), Gamma_R0; @@ -712,16 +724,19 @@ procedure main() call printf(); goto l00000426; l00000426: + assume {:captureState "addr:0x894"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2204bv64, true; call #free(); goto l00000435; l00000435: + assume {:captureState "addr:0x89c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2212bv64, true; call #free(); goto l00000443; l00000443: + assume {:captureState "addr:0x8a4"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -729,7 +744,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2248bv64) == 1bv8); free requires (memory_load8_le(mem, 2249bv64) == 0bv8); @@ -946,7 +961,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2248bv64) == 1bv8); free requires (memory_load8_le(mem, 2249bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local/gcc_O2/malloc_with_local.expected b/src/test/correct/malloc_with_local/gcc_O2/malloc_with_local.expected index 8f3b6dc33..023c5c714 100644 --- a/src/test/correct/malloc_with_local/gcc_O2/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/gcc_O2/malloc_with_local.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2088bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R2: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2088bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -153,7 +153,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -162,12 +162,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure __printf_chk(); +procedure __printf_chk(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2088bv64) == 1bv8); free requires (memory_load8_le(mem, 2089bv64) == 0bv8); @@ -384,7 +384,7 @@ procedure __printf_chk(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R1, R16, R17, R2, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -621,12 +621,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv64; - var Gamma_#1: bool; + var #1: bv64; + var Gamma_#1: bool; lmain: + assume {:captureState "addr:0x680"}true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); + assume {:captureState "addr:0x680"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#1, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#1, 8bv64), Gamma_R30); + assume {:captureState "addr:0x680"}true; R31, Gamma_R31 := #1, Gamma_#1; R2, Gamma_R2 := 65bv64, true; R1, Gamma_R1 := 0bv64, true; @@ -637,6 +640,7 @@ procedure main() call __printf_chk(); goto l00000221; l00000221: + assume {:captureState "addr:0x69c"}true; R2, Gamma_R2 := 42bv64, true; R1, Gamma_R1 := 0bv64, true; R0, Gamma_R0 := 1bv64, true; @@ -645,6 +649,7 @@ procedure main() call __printf_chk(); goto l0000023d; l0000023d: + assume {:captureState "addr:0x6b0"}true; R2, Gamma_R2 := 10bv64, true; R1, Gamma_R1 := 0bv64, true; R0, Gamma_R0 := 1bv64, true; @@ -653,6 +658,7 @@ procedure main() call __printf_chk(); goto l00000259; l00000259: + assume {:captureState "addr:0x6c4"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local/gcc_no_plt_no_pic/malloc_with_local.expected b/src/test/correct/malloc_with_local/gcc_no_plt_no_pic/malloc_with_local.expected index 818217a0f..438bb13d4 100644 --- a/src/test/correct/malloc_with_local/gcc_no_plt_no_pic/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/gcc_no_plt_no_pic/malloc_with_local.expected @@ -1,79 +1,79 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2248bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2248bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,12 +194,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2248bv64) == 1bv8); free requires (memory_load8_le(mem, 2249bv64) == 0bv8); @@ -416,7 +416,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -653,12 +653,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x814"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x814"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -666,25 +669,32 @@ procedure main() call malloc(); goto l00000ac0; l00000ac0: + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); + assume {:captureState "addr:0x824"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2096bv64, true; call malloc(); goto l00000ad4; l00000ad4: + assume {:captureState "addr:0x830"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); + assume {:captureState "addr:0x830"}true; R0, Gamma_R0 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x838"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x844"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x850"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -695,6 +705,7 @@ procedure main() call printf(); goto l00000b38; l00000b38: + assume {:captureState "addr:0x86c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -705,6 +716,7 @@ procedure main() call printf(); goto l00000b5e; l00000b5e: + assume {:captureState "addr:0x884"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2296bv64), Gamma_R0; @@ -712,16 +724,19 @@ procedure main() call printf(); goto l00000b77; l00000b77: + assume {:captureState "addr:0x894"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2204bv64, true; call #free(); goto l00000b86; l00000b86: + assume {:captureState "addr:0x89c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2212bv64, true; call #free(); goto l00000b94; l00000b94: + assume {:captureState "addr:0x8a4"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -729,7 +744,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2248bv64) == 1bv8); free requires (memory_load8_le(mem, 2249bv64) == 0bv8); @@ -946,7 +961,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2248bv64) == 1bv8); free requires (memory_load8_le(mem, 2249bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local/gcc_pic/malloc_with_local.expected b/src/test/correct/malloc_with_local/gcc_pic/malloc_with_local.expected index 818217a0f..438bb13d4 100644 --- a/src/test/correct/malloc_with_local/gcc_pic/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/gcc_pic/malloc_with_local.expected @@ -1,79 +1,79 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2248bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2248bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,12 +194,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2248bv64) == 1bv8); free requires (memory_load8_le(mem, 2249bv64) == 0bv8); @@ -416,7 +416,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -653,12 +653,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x814"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x814"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -666,25 +669,32 @@ procedure main() call malloc(); goto l00000ac0; l00000ac0: + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); + assume {:captureState "addr:0x824"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2096bv64, true; call malloc(); goto l00000ad4; l00000ad4: + assume {:captureState "addr:0x830"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); + assume {:captureState "addr:0x830"}true; R0, Gamma_R0 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x838"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x844"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x850"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -695,6 +705,7 @@ procedure main() call printf(); goto l00000b38; l00000b38: + assume {:captureState "addr:0x86c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -705,6 +716,7 @@ procedure main() call printf(); goto l00000b5e; l00000b5e: + assume {:captureState "addr:0x884"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2296bv64), Gamma_R0; @@ -712,16 +724,19 @@ procedure main() call printf(); goto l00000b77; l00000b77: + assume {:captureState "addr:0x894"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2204bv64, true; call #free(); goto l00000b86; l00000b86: + assume {:captureState "addr:0x89c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2212bv64, true; call #free(); goto l00000b94; l00000b94: + assume {:captureState "addr:0x8a4"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -729,7 +744,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2248bv64) == 1bv8); free requires (memory_load8_le(mem, 2249bv64) == 0bv8); @@ -946,7 +961,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2248bv64) == 1bv8); free requires (memory_load8_le(mem, 2249bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local2/clang/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/clang/malloc_with_local2.expected index dc03e7a27..6e3304845 100644 --- a/src/test/correct/malloc_with_local2/clang/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/clang/malloc_with_local2.expected @@ -1,83 +1,83 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2292bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2292bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,12 +187,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2292bv64) == 1bv8); free requires (memory_load8_le(mem, 2293bv64) == 0bv8); @@ -387,7 +387,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -602,55 +602,72 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x818"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x818"}true; R29, Gamma_R29 := bvadd64(R31, 64bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); + assume {:captureState "addr:0x828"}true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l000003b5; l000003b5: + assume {:captureState "addr:0x834"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R29, 18446744073709551600bv64), R0), gamma_store64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64), Gamma_R0); + assume {:captureState "addr:0x834"}true; R8, Gamma_R8 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551596bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551596bv64), Gamma_R8); + assume {:captureState "addr:0x83c"}true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store64_le(stack, R31, R0), gamma_store64(Gamma_stack, R31, Gamma_R0); + assume {:captureState "addr:0x844"}true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l000003de; l000003de: + assume {:captureState "addr:0x84c"}true; R8, Gamma_R8 := R0, Gamma_R0; R0, Gamma_R0 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R8); + assume {:captureState "addr:0x854"}true; R8, Gamma_R8 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R8); + assume {:captureState "addr:0x85c"}true; R30, Gamma_R30 := 2148bv64, true; call malloc(); goto l00000407; l00000407: + assume {:captureState "addr:0x864"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); + assume {:captureState "addr:0x864"}true; R8, Gamma_R8 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x86c"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x878"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x884"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -660,6 +677,7 @@ procedure main() call printf(); goto l00000465; l00000465: + assume {:captureState "addr:0x89c"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -669,6 +687,7 @@ procedure main() call printf(); goto l00000485; l00000485: + assume {:captureState "addr:0x8b0"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2329bv64), Gamma_R0; @@ -676,16 +695,19 @@ procedure main() call printf(); goto l0000049e; l0000049e: + assume {:captureState "addr:0x8c0"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2248bv64, true; call #free(); goto l000004ad; l000004ad: + assume {:captureState "addr:0x8c8"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2256bv64, true; call #free(); goto l000004bb; l000004bb: + assume {:captureState "addr:0x8d0"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd64(R31, 64bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -694,7 +716,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2292bv64) == 1bv8); free requires (memory_load8_le(mem, 2293bv64) == 0bv8); @@ -889,7 +911,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2292bv64) == 1bv8); free requires (memory_load8_le(mem, 2293bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local2/clang_O2/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/clang_O2/malloc_with_local2.expected index 2989a2ee6..9d23a723c 100644 --- a/src/test/correct/malloc_with_local2/clang_O2/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/clang_O2/malloc_with_local2.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1964bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1964bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -140,7 +140,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -149,12 +149,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -369,12 +369,15 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x754"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x754"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 0bv64, true; @@ -384,6 +387,7 @@ procedure main() call printf(); goto l00000322; l00000322: + assume {:captureState "addr:0x76c"}true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 1985bv64), Gamma_R0; R1, Gamma_R1 := 42bv64, true; @@ -391,6 +395,7 @@ procedure main() call printf(); goto l00000339; l00000339: + assume {:captureState "addr:0x77c"}true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2001bv64), Gamma_R0; R1, Gamma_R1 := 10bv64, true; @@ -398,6 +403,7 @@ procedure main() call printf(); goto l00000350; l00000350: + assume {:captureState "addr:0x78c"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -405,7 +411,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1964bv64) == 1bv8); free requires (memory_load8_le(mem, 1965bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local2/clang_no_plt_no_pic/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/clang_no_plt_no_pic/malloc_with_local2.expected index 4eced541a..b677f7d99 100644 --- a/src/test/correct/malloc_with_local2/clang_no_plt_no_pic/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/clang_no_plt_no_pic/malloc_with_local2.expected @@ -1,83 +1,83 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2292bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2292bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,12 +187,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2292bv64) == 1bv8); free requires (memory_load8_le(mem, 2293bv64) == 0bv8); @@ -387,7 +387,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -602,55 +602,72 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x818"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x818"}true; R29, Gamma_R29 := bvadd64(R31, 64bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); + assume {:captureState "addr:0x828"}true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000b92; l00000b92: + assume {:captureState "addr:0x834"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R29, 18446744073709551600bv64), R0), gamma_store64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64), Gamma_R0); + assume {:captureState "addr:0x834"}true; R8, Gamma_R8 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551596bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551596bv64), Gamma_R8); + assume {:captureState "addr:0x83c"}true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store64_le(stack, R31, R0), gamma_store64(Gamma_stack, R31, Gamma_R0); + assume {:captureState "addr:0x844"}true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000bbb; l00000bbb: + assume {:captureState "addr:0x84c"}true; R8, Gamma_R8 := R0, Gamma_R0; R0, Gamma_R0 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R8); + assume {:captureState "addr:0x854"}true; R8, Gamma_R8 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R8); + assume {:captureState "addr:0x85c"}true; R30, Gamma_R30 := 2148bv64, true; call malloc(); goto l00000be4; l00000be4: + assume {:captureState "addr:0x864"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); + assume {:captureState "addr:0x864"}true; R8, Gamma_R8 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x86c"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x878"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x884"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -660,6 +677,7 @@ procedure main() call printf(); goto l00000c42; l00000c42: + assume {:captureState "addr:0x89c"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -669,6 +687,7 @@ procedure main() call printf(); goto l00000c62; l00000c62: + assume {:captureState "addr:0x8b0"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2329bv64), Gamma_R0; @@ -676,16 +695,19 @@ procedure main() call printf(); goto l00000c7b; l00000c7b: + assume {:captureState "addr:0x8c0"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2248bv64, true; call #free(); goto l00000c8a; l00000c8a: + assume {:captureState "addr:0x8c8"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2256bv64, true; call #free(); goto l00000c98; l00000c98: + assume {:captureState "addr:0x8d0"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd64(R31, 64bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -694,7 +716,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2292bv64) == 1bv8); free requires (memory_load8_le(mem, 2293bv64) == 0bv8); @@ -889,7 +911,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2292bv64) == 1bv8); free requires (memory_load8_le(mem, 2293bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local2/clang_pic/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/clang_pic/malloc_with_local2.expected index 4eced541a..b677f7d99 100644 --- a/src/test/correct/malloc_with_local2/clang_pic/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/clang_pic/malloc_with_local2.expected @@ -1,83 +1,83 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2292bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2292bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,12 +187,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2292bv64) == 1bv8); free requires (memory_load8_le(mem, 2293bv64) == 0bv8); @@ -387,7 +387,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -602,55 +602,72 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x818"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x818"}true; R29, Gamma_R29 := bvadd64(R31, 64bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); + assume {:captureState "addr:0x828"}true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000b92; l00000b92: + assume {:captureState "addr:0x834"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R29, 18446744073709551600bv64), R0), gamma_store64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64), Gamma_R0); + assume {:captureState "addr:0x834"}true; R8, Gamma_R8 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551596bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551596bv64), Gamma_R8); + assume {:captureState "addr:0x83c"}true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store64_le(stack, R31, R0), gamma_store64(Gamma_stack, R31, Gamma_R0); + assume {:captureState "addr:0x844"}true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000bbb; l00000bbb: + assume {:captureState "addr:0x84c"}true; R8, Gamma_R8 := R0, Gamma_R0; R0, Gamma_R0 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R8); + assume {:captureState "addr:0x854"}true; R8, Gamma_R8 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R8); + assume {:captureState "addr:0x85c"}true; R30, Gamma_R30 := 2148bv64, true; call malloc(); goto l00000be4; l00000be4: + assume {:captureState "addr:0x864"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); + assume {:captureState "addr:0x864"}true; R8, Gamma_R8 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x86c"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x878"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x884"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -660,6 +677,7 @@ procedure main() call printf(); goto l00000c42; l00000c42: + assume {:captureState "addr:0x89c"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -669,6 +687,7 @@ procedure main() call printf(); goto l00000c62; l00000c62: + assume {:captureState "addr:0x8b0"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2329bv64), Gamma_R0; @@ -676,16 +695,19 @@ procedure main() call printf(); goto l00000c7b; l00000c7b: + assume {:captureState "addr:0x8c0"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2248bv64, true; call #free(); goto l00000c8a; l00000c8a: + assume {:captureState "addr:0x8c8"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2256bv64, true; call #free(); goto l00000c98; l00000c98: + assume {:captureState "addr:0x8d0"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd64(R31, 64bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -694,7 +716,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2292bv64) == 1bv8); free requires (memory_load8_le(mem, 2293bv64) == 0bv8); @@ -889,7 +911,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2292bv64) == 1bv8); free requires (memory_load8_le(mem, 2293bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local2/gcc/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/gcc/malloc_with_local2.expected index eb2fbbaac..a749b374b 100644 --- a/src/test/correct/malloc_with_local2/gcc/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/gcc/malloc_with_local2.expected @@ -1,79 +1,79 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2272bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2272bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,12 +194,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2272bv64) == 1bv8); free requires (memory_load8_le(mem, 2273bv64) == 0bv8); @@ -416,7 +416,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -653,12 +653,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x814"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x814"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -666,35 +669,46 @@ procedure main() call malloc(); goto l0000038b; l0000038b: + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); + assume {:captureState "addr:0x824"}true; R0, Gamma_R0 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x82c"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2104bv64, true; call malloc(); goto l000003ac; l000003ac: + assume {:captureState "addr:0x838"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 48bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 48bv64), Gamma_R0); + assume {:captureState "addr:0x838"}true; R0, Gamma_R0 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 32bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); + assume {:captureState "addr:0x840"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l000003cd; l000003cd: + assume {:captureState "addr:0x84c"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 56bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 56bv64), Gamma_R0); + assume {:captureState "addr:0x84c"}true; R0, Gamma_R0 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 36bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 36bv64), Gamma_R0); + assume {:captureState "addr:0x854"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x860"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x86c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -705,6 +719,7 @@ procedure main() call printf(); goto l00000431; l00000431: + assume {:captureState "addr:0x888"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -715,6 +730,7 @@ procedure main() call printf(); goto l00000457; l00000457: + assume {:captureState "addr:0x8a0"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 32bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 32bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2320bv64), Gamma_R0; @@ -722,16 +738,19 @@ procedure main() call printf(); goto l00000470; l00000470: + assume {:captureState "addr:0x8b0"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2232bv64, true; call #free(); goto l0000047f; l0000047f: + assume {:captureState "addr:0x8b8"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R30, Gamma_R30 := 2240bv64, true; call #free(); goto l0000048d; l0000048d: + assume {:captureState "addr:0x8c0"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -739,7 +758,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2272bv64) == 1bv8); free requires (memory_load8_le(mem, 2273bv64) == 0bv8); @@ -956,7 +975,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2272bv64) == 1bv8); free requires (memory_load8_le(mem, 2273bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local2/gcc_O2/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/gcc_O2/malloc_with_local2.expected index 8f3b6dc33..023c5c714 100644 --- a/src/test/correct/malloc_with_local2/gcc_O2/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/gcc_O2/malloc_with_local2.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2088bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R2: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2088bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -153,7 +153,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -162,12 +162,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure __printf_chk(); +procedure __printf_chk(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2088bv64) == 1bv8); free requires (memory_load8_le(mem, 2089bv64) == 0bv8); @@ -384,7 +384,7 @@ procedure __printf_chk(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R1, R16, R17, R2, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -621,12 +621,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv64; - var Gamma_#1: bool; + var #1: bv64; + var Gamma_#1: bool; lmain: + assume {:captureState "addr:0x680"}true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); + assume {:captureState "addr:0x680"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#1, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#1, 8bv64), Gamma_R30); + assume {:captureState "addr:0x680"}true; R31, Gamma_R31 := #1, Gamma_#1; R2, Gamma_R2 := 65bv64, true; R1, Gamma_R1 := 0bv64, true; @@ -637,6 +640,7 @@ procedure main() call __printf_chk(); goto l00000221; l00000221: + assume {:captureState "addr:0x69c"}true; R2, Gamma_R2 := 42bv64, true; R1, Gamma_R1 := 0bv64, true; R0, Gamma_R0 := 1bv64, true; @@ -645,6 +649,7 @@ procedure main() call __printf_chk(); goto l0000023d; l0000023d: + assume {:captureState "addr:0x6b0"}true; R2, Gamma_R2 := 10bv64, true; R1, Gamma_R1 := 0bv64, true; R0, Gamma_R0 := 1bv64, true; @@ -653,6 +658,7 @@ procedure main() call __printf_chk(); goto l00000259; l00000259: + assume {:captureState "addr:0x6c4"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local2/gcc_no_plt_no_pic/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/gcc_no_plt_no_pic/malloc_with_local2.expected index 652536323..8372c230e 100644 --- a/src/test/correct/malloc_with_local2/gcc_no_plt_no_pic/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/gcc_no_plt_no_pic/malloc_with_local2.expected @@ -1,79 +1,79 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2272bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2272bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,12 +194,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2272bv64) == 1bv8); free requires (memory_load8_le(mem, 2273bv64) == 0bv8); @@ -416,7 +416,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -653,12 +653,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x814"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x814"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -666,35 +669,46 @@ procedure main() call malloc(); goto l00000b2d; l00000b2d: + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); + assume {:captureState "addr:0x824"}true; R0, Gamma_R0 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x82c"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2104bv64, true; call malloc(); goto l00000b4e; l00000b4e: + assume {:captureState "addr:0x838"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 48bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 48bv64), Gamma_R0); + assume {:captureState "addr:0x838"}true; R0, Gamma_R0 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 32bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); + assume {:captureState "addr:0x840"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000b6f; l00000b6f: + assume {:captureState "addr:0x84c"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 56bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 56bv64), Gamma_R0); + assume {:captureState "addr:0x84c"}true; R0, Gamma_R0 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 36bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 36bv64), Gamma_R0); + assume {:captureState "addr:0x854"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x860"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x86c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -705,6 +719,7 @@ procedure main() call printf(); goto l00000bd3; l00000bd3: + assume {:captureState "addr:0x888"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -715,6 +730,7 @@ procedure main() call printf(); goto l00000bf9; l00000bf9: + assume {:captureState "addr:0x8a0"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 32bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 32bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2320bv64), Gamma_R0; @@ -722,16 +738,19 @@ procedure main() call printf(); goto l00000c12; l00000c12: + assume {:captureState "addr:0x8b0"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2232bv64, true; call #free(); goto l00000c21; l00000c21: + assume {:captureState "addr:0x8b8"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R30, Gamma_R30 := 2240bv64, true; call #free(); goto l00000c2f; l00000c2f: + assume {:captureState "addr:0x8c0"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -739,7 +758,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2272bv64) == 1bv8); free requires (memory_load8_le(mem, 2273bv64) == 0bv8); @@ -956,7 +975,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2272bv64) == 1bv8); free requires (memory_load8_le(mem, 2273bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local2/gcc_pic/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/gcc_pic/malloc_with_local2.expected index 652536323..8372c230e 100644 --- a/src/test/correct/malloc_with_local2/gcc_pic/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/gcc_pic/malloc_with_local2.expected @@ -1,79 +1,79 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2272bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2272bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,12 +194,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2272bv64) == 1bv8); free requires (memory_load8_le(mem, 2273bv64) == 0bv8); @@ -416,7 +416,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -653,12 +653,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x814"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x814"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -666,35 +669,46 @@ procedure main() call malloc(); goto l00000b2d; l00000b2d: + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); + assume {:captureState "addr:0x824"}true; R0, Gamma_R0 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x82c"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2104bv64, true; call malloc(); goto l00000b4e; l00000b4e: + assume {:captureState "addr:0x838"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 48bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 48bv64), Gamma_R0); + assume {:captureState "addr:0x838"}true; R0, Gamma_R0 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 32bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); + assume {:captureState "addr:0x840"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000b6f; l00000b6f: + assume {:captureState "addr:0x84c"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 56bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 56bv64), Gamma_R0); + assume {:captureState "addr:0x84c"}true; R0, Gamma_R0 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 36bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 36bv64), Gamma_R0); + assume {:captureState "addr:0x854"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x860"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x86c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -705,6 +719,7 @@ procedure main() call printf(); goto l00000bd3; l00000bd3: + assume {:captureState "addr:0x888"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -715,6 +730,7 @@ procedure main() call printf(); goto l00000bf9; l00000bf9: + assume {:captureState "addr:0x8a0"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 32bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 32bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2320bv64), Gamma_R0; @@ -722,16 +738,19 @@ procedure main() call printf(); goto l00000c12; l00000c12: + assume {:captureState "addr:0x8b0"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2232bv64, true; call #free(); goto l00000c21; l00000c21: + assume {:captureState "addr:0x8b8"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R30, Gamma_R30 := 2240bv64, true; call #free(); goto l00000c2f; l00000c2f: + assume {:captureState "addr:0x8c0"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -739,7 +758,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2272bv64) == 1bv8); free requires (memory_load8_le(mem, 2273bv64) == 0bv8); @@ -956,7 +975,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2272bv64) == 1bv8); free requires (memory_load8_le(mem, 2273bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local3/clang/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/clang/malloc_with_local3.expected index 58f3308ab..8e63d24b0 100644 --- a/src/test/correct/malloc_with_local3/clang/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/clang/malloc_with_local3.expected @@ -1,84 +1,84 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2344bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2344bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,12 +194,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); @@ -406,7 +406,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -633,60 +633,78 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #7: bv64; - var Gamma_#4: bool; - var Gamma_#7: bool; + var #4: bv64; + var #7: bv64; + var Gamma_#4: bool; + var Gamma_#7: bool; lmain: + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x818"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x818"}true; R29, Gamma_R29 := bvadd64(R31, 64bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); + assume {:captureState "addr:0x828"}true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l000003e9; l000003e9: + assume {:captureState "addr:0x834"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R29, 18446744073709551600bv64), R0), gamma_store64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64), Gamma_R0); + assume {:captureState "addr:0x834"}true; R8, Gamma_R8 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551596bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551596bv64), Gamma_R8); + assume {:captureState "addr:0x83c"}true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store64_le(stack, R31, R0), gamma_store64(Gamma_stack, R31, Gamma_R0); + assume {:captureState "addr:0x844"}true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000412; l00000412: + assume {:captureState "addr:0x84c"}true; R8, Gamma_R8 := R0, Gamma_R0; R0, Gamma_R0 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R8); + assume {:captureState "addr:0x854"}true; R8, Gamma_R8 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R8); + assume {:captureState "addr:0x85c"}true; R30, Gamma_R30 := 2148bv64, true; call malloc(); goto l0000043b; l0000043b: + assume {:captureState "addr:0x864"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); + assume {:captureState "addr:0x864"}true; R8, Gamma_R8 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x86c"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x878"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x884"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2192bv64, true; call printCharValue(); goto l00000504; l00000504: + assume {:captureState "addr:0x890"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -696,6 +714,7 @@ procedure main() call printf(); goto l00000524; l00000524: + assume {:captureState "addr:0x8a4"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2364bv64), Gamma_R0; @@ -703,16 +722,19 @@ procedure main() call printf(); goto l0000053d; l0000053d: + assume {:captureState "addr:0x8b4"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2236bv64, true; call #free(); goto l0000054c; l0000054c: + assume {:captureState "addr:0x8bc"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2244bv64, true; call #free(); goto l0000055a; l0000055a: + assume {:captureState "addr:0x8c4"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #7, Gamma_#7 := bvadd64(R31, 64bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #7), gamma_load64(Gamma_stack, #7); @@ -721,7 +743,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); @@ -928,7 +950,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printCharValue() +procedure printCharValue() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); @@ -1139,17 +1161,21 @@ procedure printCharValue() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #5: bv64; - var #6: bv64; - var Gamma_#5: bool; - var Gamma_#6: bool; + var #5: bv64; + var #6: bv64; + var Gamma_#5: bool; + var Gamma_#6: bool; lprintCharValue: + assume {:captureState "addr:0x8d4"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); + assume {:captureState "addr:0x8d8"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#5, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#5, 8bv64), Gamma_R30); + assume {:captureState "addr:0x8d8"}true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x8e0"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R8, Gamma_R8 := zero_extend56_8(memory_load8_le(mem, R9)), (gamma_load8(Gamma_mem, R9) || L(mem, R9)); @@ -1157,6 +1183,7 @@ procedure printCharValue() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x8f0"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -1166,6 +1193,7 @@ procedure printCharValue() call printf(); goto l000004e9; l000004e9: + assume {:captureState "addr:0x908"}true; #6, Gamma_#6 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #6), gamma_load64(Gamma_stack, #6); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(#6, 8bv64)), gamma_load64(Gamma_stack, bvadd64(#6, 8bv64)); @@ -1173,7 +1201,7 @@ procedure printCharValue() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local3/clang_O2/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/clang_O2/malloc_with_local3.expected index a4afe325d..abdd2f976 100644 --- a/src/test/correct/malloc_with_local3/clang_O2/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/clang_O2/malloc_with_local3.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1996bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1996bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -146,7 +146,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -155,12 +155,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -387,12 +387,15 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x754"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x754"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 0bv64, true; @@ -402,6 +405,7 @@ procedure main() call printf(); goto l00000342; l00000342: + assume {:captureState "addr:0x76c"}true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2000bv64), Gamma_R0; R1, Gamma_R1 := 42bv64, true; @@ -409,6 +413,7 @@ procedure main() call printf(); goto l00000359; l00000359: + assume {:captureState "addr:0x77c"}true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2016bv64), Gamma_R0; R1, Gamma_R1 := 10bv64, true; @@ -416,6 +421,7 @@ procedure main() call printf(); goto l00000370; l00000370: + assume {:captureState "addr:0x78c"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -423,7 +429,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1996bv64) == 1bv8); free requires (memory_load8_le(mem, 1997bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local3/clang_no_plt_no_pic/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/clang_no_plt_no_pic/malloc_with_local3.expected index 1f9ca1021..fc27896ba 100644 --- a/src/test/correct/malloc_with_local3/clang_no_plt_no_pic/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/clang_no_plt_no_pic/malloc_with_local3.expected @@ -1,84 +1,84 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2344bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2344bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,12 +194,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); @@ -406,7 +406,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -633,60 +633,78 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #7: bv64; - var Gamma_#4: bool; - var Gamma_#7: bool; + var #4: bv64; + var #7: bv64; + var Gamma_#4: bool; + var Gamma_#7: bool; lmain: + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x818"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x818"}true; R29, Gamma_R29 := bvadd64(R31, 64bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); + assume {:captureState "addr:0x828"}true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000c74; l00000c74: + assume {:captureState "addr:0x834"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R29, 18446744073709551600bv64), R0), gamma_store64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64), Gamma_R0); + assume {:captureState "addr:0x834"}true; R8, Gamma_R8 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551596bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551596bv64), Gamma_R8); + assume {:captureState "addr:0x83c"}true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store64_le(stack, R31, R0), gamma_store64(Gamma_stack, R31, Gamma_R0); + assume {:captureState "addr:0x844"}true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000c9d; l00000c9d: + assume {:captureState "addr:0x84c"}true; R8, Gamma_R8 := R0, Gamma_R0; R0, Gamma_R0 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R8); + assume {:captureState "addr:0x854"}true; R8, Gamma_R8 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R8); + assume {:captureState "addr:0x85c"}true; R30, Gamma_R30 := 2148bv64, true; call malloc(); goto l00000cc6; l00000cc6: + assume {:captureState "addr:0x864"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); + assume {:captureState "addr:0x864"}true; R8, Gamma_R8 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x86c"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x878"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x884"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2192bv64, true; call printCharValue(); goto l00000d8f; l00000d8f: + assume {:captureState "addr:0x890"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -696,6 +714,7 @@ procedure main() call printf(); goto l00000daf; l00000daf: + assume {:captureState "addr:0x8a4"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2364bv64), Gamma_R0; @@ -703,16 +722,19 @@ procedure main() call printf(); goto l00000dc8; l00000dc8: + assume {:captureState "addr:0x8b4"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2236bv64, true; call #free(); goto l00000dd7; l00000dd7: + assume {:captureState "addr:0x8bc"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2244bv64, true; call #free(); goto l00000de5; l00000de5: + assume {:captureState "addr:0x8c4"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #7, Gamma_#7 := bvadd64(R31, 64bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #7), gamma_load64(Gamma_stack, #7); @@ -721,7 +743,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); @@ -928,7 +950,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printCharValue() +procedure printCharValue() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); @@ -1139,17 +1161,21 @@ procedure printCharValue() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #5: bv64; - var #6: bv64; - var Gamma_#5: bool; - var Gamma_#6: bool; + var #5: bv64; + var #6: bv64; + var Gamma_#5: bool; + var Gamma_#6: bool; lprintCharValue: + assume {:captureState "addr:0x8d4"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); + assume {:captureState "addr:0x8d8"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#5, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#5, 8bv64), Gamma_R30); + assume {:captureState "addr:0x8d8"}true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x8e0"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R8, Gamma_R8 := zero_extend56_8(memory_load8_le(mem, R9)), (gamma_load8(Gamma_mem, R9) || L(mem, R9)); @@ -1157,6 +1183,7 @@ procedure printCharValue() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x8f0"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -1166,6 +1193,7 @@ procedure printCharValue() call printf(); goto l00000d74; l00000d74: + assume {:captureState "addr:0x908"}true; #6, Gamma_#6 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #6), gamma_load64(Gamma_stack, #6); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(#6, 8bv64)), gamma_load64(Gamma_stack, bvadd64(#6, 8bv64)); @@ -1173,7 +1201,7 @@ procedure printCharValue() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local3/clang_pic/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/clang_pic/malloc_with_local3.expected index 1f9ca1021..fc27896ba 100644 --- a/src/test/correct/malloc_with_local3/clang_pic/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/clang_pic/malloc_with_local3.expected @@ -1,84 +1,84 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2344bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2344bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,12 +194,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); @@ -406,7 +406,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -633,60 +633,78 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #7: bv64; - var Gamma_#4: bool; - var Gamma_#7: bool; + var #4: bv64; + var #7: bv64; + var Gamma_#4: bool; + var Gamma_#7: bool; lmain: + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x818"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x818"}true; R29, Gamma_R29 := bvadd64(R31, 64bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); + assume {:captureState "addr:0x828"}true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000c74; l00000c74: + assume {:captureState "addr:0x834"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R29, 18446744073709551600bv64), R0), gamma_store64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64), Gamma_R0); + assume {:captureState "addr:0x834"}true; R8, Gamma_R8 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551596bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551596bv64), Gamma_R8); + assume {:captureState "addr:0x83c"}true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store64_le(stack, R31, R0), gamma_store64(Gamma_stack, R31, Gamma_R0); + assume {:captureState "addr:0x844"}true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000c9d; l00000c9d: + assume {:captureState "addr:0x84c"}true; R8, Gamma_R8 := R0, Gamma_R0; R0, Gamma_R0 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R8); + assume {:captureState "addr:0x854"}true; R8, Gamma_R8 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R8); + assume {:captureState "addr:0x85c"}true; R30, Gamma_R30 := 2148bv64, true; call malloc(); goto l00000cc6; l00000cc6: + assume {:captureState "addr:0x864"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); + assume {:captureState "addr:0x864"}true; R8, Gamma_R8 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x86c"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x878"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x884"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2192bv64, true; call printCharValue(); goto l00000d8f; l00000d8f: + assume {:captureState "addr:0x890"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -696,6 +714,7 @@ procedure main() call printf(); goto l00000daf; l00000daf: + assume {:captureState "addr:0x8a4"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2364bv64), Gamma_R0; @@ -703,16 +722,19 @@ procedure main() call printf(); goto l00000dc8; l00000dc8: + assume {:captureState "addr:0x8b4"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2236bv64, true; call #free(); goto l00000dd7; l00000dd7: + assume {:captureState "addr:0x8bc"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2244bv64, true; call #free(); goto l00000de5; l00000de5: + assume {:captureState "addr:0x8c4"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #7, Gamma_#7 := bvadd64(R31, 64bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #7), gamma_load64(Gamma_stack, #7); @@ -721,7 +743,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); @@ -928,7 +950,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printCharValue() +procedure printCharValue() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); @@ -1139,17 +1161,21 @@ procedure printCharValue() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #5: bv64; - var #6: bv64; - var Gamma_#5: bool; - var Gamma_#6: bool; + var #5: bv64; + var #6: bv64; + var Gamma_#5: bool; + var Gamma_#6: bool; lprintCharValue: + assume {:captureState "addr:0x8d4"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); + assume {:captureState "addr:0x8d8"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#5, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#5, 8bv64), Gamma_R30); + assume {:captureState "addr:0x8d8"}true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x8e0"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R8, Gamma_R8 := zero_extend56_8(memory_load8_le(mem, R9)), (gamma_load8(Gamma_mem, R9) || L(mem, R9)); @@ -1157,6 +1183,7 @@ procedure printCharValue() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x8f0"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -1166,6 +1193,7 @@ procedure printCharValue() call printf(); goto l00000d74; l00000d74: + assume {:captureState "addr:0x908"}true; #6, Gamma_#6 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #6), gamma_load64(Gamma_stack, #6); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(#6, 8bv64)), gamma_load64(Gamma_stack, bvadd64(#6, 8bv64)); @@ -1173,7 +1201,7 @@ procedure printCharValue() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2344bv64) == 1bv8); free requires (memory_load8_le(mem, 2345bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local3/gcc/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/gcc/malloc_with_local3.expected index 9eabf2e81..10b8ebb3f 100644 --- a/src/test/correct/malloc_with_local3/gcc/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/gcc/malloc_with_local3.expected @@ -1,80 +1,80 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2328bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2328bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -190,7 +190,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -199,12 +199,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); @@ -429,7 +429,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -674,12 +674,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x814"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x814"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -687,40 +690,52 @@ procedure main() call malloc(); goto l000003c3; l000003c3: + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); + assume {:captureState "addr:0x824"}true; R0, Gamma_R0 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x82c"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2104bv64, true; call malloc(); goto l000003e4; l000003e4: + assume {:captureState "addr:0x838"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 48bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 48bv64), Gamma_R0); + assume {:captureState "addr:0x838"}true; R0, Gamma_R0 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 32bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); + assume {:captureState "addr:0x840"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000405; l00000405: + assume {:captureState "addr:0x84c"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 56bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 56bv64), Gamma_R0); + assume {:captureState "addr:0x84c"}true; R0, Gamma_R0 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 36bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 36bv64), Gamma_R0); + assume {:captureState "addr:0x854"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x860"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x86c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2168bv64, true; call printCharValue(); goto l000004db; l000004db: + assume {:captureState "addr:0x878"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -731,6 +746,7 @@ procedure main() call printf(); goto l00000501; l00000501: + assume {:captureState "addr:0x890"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 32bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 32bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2352bv64), Gamma_R0; @@ -738,16 +754,19 @@ procedure main() call printf(); goto l0000051a; l0000051a: + assume {:captureState "addr:0x8a0"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2216bv64, true; call #free(); goto l00000529; l00000529: + assume {:captureState "addr:0x8a8"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R30, Gamma_R30 := 2224bv64, true; call #free(); goto l00000537; l00000537: + assume {:captureState "addr:0x8b0"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -755,7 +774,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); @@ -980,7 +999,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printCharValue() +procedure printCharValue() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); @@ -1209,15 +1228,19 @@ procedure printCharValue() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #5: bv64; - var Gamma_#5: bool; + var #5: bv64; + var Gamma_#5: bool; lprintCharValue: + assume {:captureState "addr:0x8bc"}true; #5, Gamma_#5 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); + assume {:captureState "addr:0x8bc"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#5, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#5, 8bv64), Gamma_R30); + assume {:captureState "addr:0x8bc"}true; R31, Gamma_R31 := #5, Gamma_#5; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x8c4"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -1227,6 +1250,7 @@ procedure printCharValue() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x8dc"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -1237,13 +1261,14 @@ procedure printCharValue() call printf(); goto l000004c4; l000004c4: + assume {:captureState "addr:0x8f8"}true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local3/gcc_O2/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/gcc_O2/malloc_with_local3.expected index 66020e141..b2fd5b9eb 100644 --- a/src/test/correct/malloc_with_local3/gcc_O2/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/gcc_O2/malloc_with_local3.expected @@ -1,70 +1,70 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R19: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R3: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R19: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R3: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2264bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R19: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R3: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R19: bv64; +var {:extern }R2: bv64; +var {:extern }R29: bv64; +var {:extern }R3: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2264bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -176,7 +176,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,12 +185,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure __printf_chk(); +procedure __printf_chk(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2264bv64) == 1bv8); free requires (memory_load8_le(mem, 2265bv64) == 0bv8); @@ -407,7 +407,7 @@ procedure __printf_chk(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2264bv64) == 1bv8); free requires (memory_load8_le(mem, 2265bv64) == 0bv8); @@ -624,7 +624,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R19, Gamma_R2, Gamma_R29, Gamma_R3, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R19, R2, R29, R3, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -863,29 +863,36 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv64; - var Gamma_#1: bool; + var #1: bv64; + var Gamma_#1: bool; lmain: + assume {:captureState "addr:0x700"}true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); + assume {:captureState "addr:0x700"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#1, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#1, 8bv64), Gamma_R30); + assume {:captureState "addr:0x700"}true; R31, Gamma_R31 := #1, Gamma_#1; R0, Gamma_R0 := 1bv64, true; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R19), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R19); + assume {:captureState "addr:0x70c"}true; R30, Gamma_R30 := 1812bv64, true; call malloc(); goto l00000249; l00000249: + assume {:captureState "addr:0x714"}true; R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x718"}true; R19, Gamma_R19 := R0, Gamma_R0; R30, Gamma_R30 := 1828bv64, true; call printCharValue(); goto l0000029a; l0000029a: + assume {:captureState "addr:0x724"}true; R2, Gamma_R2 := 42bv64, true; R1, Gamma_R1 := 0bv64, true; R0, Gamma_R0 := 1bv64, true; @@ -894,6 +901,7 @@ procedure main() call __printf_chk(); goto l000002b6; l000002b6: + assume {:captureState "addr:0x738"}true; R1, Gamma_R1 := 0bv64, true; R1, Gamma_R1 := bvadd64(R1, 2312bv64), Gamma_R1; R2, Gamma_R2 := 10bv64, true; @@ -902,11 +910,13 @@ procedure main() call __printf_chk(); goto l000002d2; l000002d2: + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := R19, Gamma_R19; R30, Gamma_R30 := 1876bv64, true; call #free(); goto l000002e0; l000002e0: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 0bv64, true; R19, Gamma_R19 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); @@ -915,7 +925,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2264bv64) == 1bv8); free requires (memory_load8_le(mem, 2265bv64) == 0bv8); @@ -1132,7 +1142,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printCharValue() +procedure printCharValue() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R3, Gamma_mem, R0, R1, R16, R17, R2, R3, mem; free requires (memory_load8_le(mem, 2264bv64) == 1bv8); free requires (memory_load8_le(mem, 2265bv64) == 0bv8); @@ -1350,6 +1360,7 @@ procedure printCharValue() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lprintCharValue: + assume {:captureState "addr:0x8a0"}true; R3, Gamma_R3 := R0, Gamma_R0; R0, Gamma_R0 := 1bv64, true; R1, Gamma_R1 := 0bv64, true; @@ -1361,6 +1372,7 @@ procedure printCharValue() call rely(); assert (L(mem, R3) ==> Gamma_R2); mem, Gamma_mem := memory_store8_le(mem, R3, R2[8:0]), gamma_store8(Gamma_mem, R3, Gamma_R2); + assume {:captureState "addr:0x8bc"}true; call __printf_chk(); //no return target assume false; diff --git a/src/test/correct/malloc_with_local3/gcc_no_plt_no_pic/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/gcc_no_plt_no_pic/malloc_with_local3.expected index 5c8344994..deef3778f 100644 --- a/src/test/correct/malloc_with_local3/gcc_no_plt_no_pic/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/gcc_no_plt_no_pic/malloc_with_local3.expected @@ -1,80 +1,80 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2328bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2328bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -190,7 +190,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -199,12 +199,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); @@ -429,7 +429,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -674,12 +674,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x814"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x814"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -687,40 +690,52 @@ procedure main() call malloc(); goto l00000c1f; l00000c1f: + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); + assume {:captureState "addr:0x824"}true; R0, Gamma_R0 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x82c"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2104bv64, true; call malloc(); goto l00000c40; l00000c40: + assume {:captureState "addr:0x838"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 48bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 48bv64), Gamma_R0); + assume {:captureState "addr:0x838"}true; R0, Gamma_R0 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 32bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); + assume {:captureState "addr:0x840"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000c61; l00000c61: + assume {:captureState "addr:0x84c"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 56bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 56bv64), Gamma_R0); + assume {:captureState "addr:0x84c"}true; R0, Gamma_R0 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 36bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 36bv64), Gamma_R0); + assume {:captureState "addr:0x854"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x860"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x86c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2168bv64, true; call printCharValue(); goto l00000d37; l00000d37: + assume {:captureState "addr:0x878"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -731,6 +746,7 @@ procedure main() call printf(); goto l00000d5d; l00000d5d: + assume {:captureState "addr:0x890"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 32bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 32bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2352bv64), Gamma_R0; @@ -738,16 +754,19 @@ procedure main() call printf(); goto l00000d76; l00000d76: + assume {:captureState "addr:0x8a0"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2216bv64, true; call #free(); goto l00000d85; l00000d85: + assume {:captureState "addr:0x8a8"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R30, Gamma_R30 := 2224bv64, true; call #free(); goto l00000d93; l00000d93: + assume {:captureState "addr:0x8b0"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -755,7 +774,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); @@ -980,7 +999,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printCharValue() +procedure printCharValue() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); @@ -1209,15 +1228,19 @@ procedure printCharValue() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #5: bv64; - var Gamma_#5: bool; + var #5: bv64; + var Gamma_#5: bool; lprintCharValue: + assume {:captureState "addr:0x8bc"}true; #5, Gamma_#5 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); + assume {:captureState "addr:0x8bc"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#5, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#5, 8bv64), Gamma_R30); + assume {:captureState "addr:0x8bc"}true; R31, Gamma_R31 := #5, Gamma_#5; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x8c4"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -1227,6 +1250,7 @@ procedure printCharValue() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x8dc"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -1237,13 +1261,14 @@ procedure printCharValue() call printf(); goto l00000d20; l00000d20: + assume {:captureState "addr:0x8f8"}true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); diff --git a/src/test/correct/malloc_with_local3/gcc_pic/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/gcc_pic/malloc_with_local3.expected index 5c8344994..deef3778f 100644 --- a/src/test/correct/malloc_with_local3/gcc_pic/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/gcc_pic/malloc_with_local3.expected @@ -1,80 +1,80 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2328bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2328bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -190,7 +190,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -199,12 +199,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); @@ -429,7 +429,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -674,12 +674,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x814"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x814"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -687,40 +690,52 @@ procedure main() call malloc(); goto l00000c1f; l00000c1f: + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); + assume {:captureState "addr:0x824"}true; R0, Gamma_R0 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x82c"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2104bv64, true; call malloc(); goto l00000c40; l00000c40: + assume {:captureState "addr:0x838"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 48bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 48bv64), Gamma_R0); + assume {:captureState "addr:0x838"}true; R0, Gamma_R0 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 32bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); + assume {:captureState "addr:0x840"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000c61; l00000c61: + assume {:captureState "addr:0x84c"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 56bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 56bv64), Gamma_R0); + assume {:captureState "addr:0x84c"}true; R0, Gamma_R0 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 36bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 36bv64), Gamma_R0); + assume {:captureState "addr:0x854"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x860"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x86c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2168bv64, true; call printCharValue(); goto l00000d37; l00000d37: + assume {:captureState "addr:0x878"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -731,6 +746,7 @@ procedure main() call printf(); goto l00000d5d; l00000d5d: + assume {:captureState "addr:0x890"}true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 32bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 32bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2352bv64), Gamma_R0; @@ -738,16 +754,19 @@ procedure main() call printf(); goto l00000d76; l00000d76: + assume {:captureState "addr:0x8a0"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2216bv64, true; call #free(); goto l00000d85; l00000d85: + assume {:captureState "addr:0x8a8"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R30, Gamma_R30 := 2224bv64, true; call #free(); goto l00000d93; l00000d93: + assume {:captureState "addr:0x8b0"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -755,7 +774,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); @@ -980,7 +999,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printCharValue() +procedure printCharValue() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); @@ -1209,15 +1228,19 @@ procedure printCharValue() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #5: bv64; - var Gamma_#5: bool; + var #5: bv64; + var Gamma_#5: bool; lprintCharValue: + assume {:captureState "addr:0x8bc"}true; #5, Gamma_#5 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); + assume {:captureState "addr:0x8bc"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#5, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#5, 8bv64), Gamma_R30); + assume {:captureState "addr:0x8bc"}true; R31, Gamma_R31 := #5, Gamma_#5; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x8c4"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -1227,6 +1250,7 @@ procedure printCharValue() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x8dc"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -1237,13 +1261,14 @@ procedure printCharValue() call printf(); goto l00000d20; l00000d20: + assume {:captureState "addr:0x8f8"}true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2328bv64) == 1bv8); free requires (memory_load8_le(mem, 2329bv64) == 0bv8); diff --git a/src/test/correct/multi_malloc/clang/multi_malloc.expected b/src/test/correct/multi_malloc/clang/multi_malloc.expected index cb2f03f7d..957754193 100644 --- a/src/test/correct/multi_malloc/clang/multi_malloc.expected +++ b/src/test/correct/multi_malloc/clang/multi_malloc.expected @@ -1,83 +1,83 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2232bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2232bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -151,7 +151,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -160,12 +160,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2232bv64) == 1bv8); free requires (memory_load8_le(mem, 2233bv64) == 0bv8); @@ -306,7 +306,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -467,41 +467,52 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x818"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x818"}true; R29, Gamma_R29 := bvadd64(R31, 32bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); + assume {:captureState "addr:0x828"}true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000379; l00000379: + assume {:captureState "addr:0x834"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); + assume {:captureState "addr:0x834"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2112bv64, true; call malloc(); goto l0000038d; l0000038d: + assume {:captureState "addr:0x840"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x840"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x84c"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x858"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -511,6 +522,7 @@ procedure main() call printf(); goto l000003de; l000003de: + assume {:captureState "addr:0x870"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -520,16 +532,19 @@ procedure main() call printf(); goto l000003fe; l000003fe: + assume {:captureState "addr:0x884"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2188bv64, true; call #free(); goto l0000040d; l0000040d: + assume {:captureState "addr:0x88c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2196bv64, true; call #free(); goto l0000041b; l0000041b: + assume {:captureState "addr:0x894"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -538,7 +553,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2232bv64) == 1bv8); free requires (memory_load8_le(mem, 2233bv64) == 0bv8); @@ -679,7 +694,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2232bv64) == 1bv8); free requires (memory_load8_le(mem, 2233bv64) == 0bv8); diff --git a/src/test/correct/multi_malloc/clang_O2/multi_malloc.expected b/src/test/correct/multi_malloc/clang_O2/multi_malloc.expected index 569ac0ece..983f2bee1 100644 --- a/src/test/correct/multi_malloc/clang_O2/multi_malloc.expected +++ b/src/test/correct/multi_malloc/clang_O2/multi_malloc.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1948bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1948bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -113,7 +113,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -122,12 +122,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -288,12 +288,15 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x754"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x754"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 0bv64, true; @@ -303,6 +306,7 @@ procedure main() call printf(); goto l00000312; l00000312: + assume {:captureState "addr:0x76c"}true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 1969bv64), Gamma_R0; R1, Gamma_R1 := 42bv64, true; @@ -310,6 +314,7 @@ procedure main() call printf(); goto l00000329; l00000329: + assume {:captureState "addr:0x77c"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -317,7 +322,7 @@ procedure main() return; } -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1948bv64) == 1bv8); free requires (memory_load8_le(mem, 1949bv64) == 0bv8); diff --git a/src/test/correct/multi_malloc/clang_no_plt_no_pic/multi_malloc.expected b/src/test/correct/multi_malloc/clang_no_plt_no_pic/multi_malloc.expected index d210207e2..86eef3bee 100644 --- a/src/test/correct/multi_malloc/clang_no_plt_no_pic/multi_malloc.expected +++ b/src/test/correct/multi_malloc/clang_no_plt_no_pic/multi_malloc.expected @@ -1,83 +1,83 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2232bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2232bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -151,7 +151,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -160,12 +160,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2232bv64) == 1bv8); free requires (memory_load8_le(mem, 2233bv64) == 0bv8); @@ -306,7 +306,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -467,41 +467,52 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x818"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x818"}true; R29, Gamma_R29 := bvadd64(R31, 32bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); + assume {:captureState "addr:0x828"}true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000aa7; l00000aa7: + assume {:captureState "addr:0x834"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); + assume {:captureState "addr:0x834"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2112bv64, true; call malloc(); goto l00000abb; l00000abb: + assume {:captureState "addr:0x840"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x840"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x84c"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x858"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -511,6 +522,7 @@ procedure main() call printf(); goto l00000b0c; l00000b0c: + assume {:captureState "addr:0x870"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -520,16 +532,19 @@ procedure main() call printf(); goto l00000b2c; l00000b2c: + assume {:captureState "addr:0x884"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2188bv64, true; call #free(); goto l00000b3b; l00000b3b: + assume {:captureState "addr:0x88c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2196bv64, true; call #free(); goto l00000b49; l00000b49: + assume {:captureState "addr:0x894"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -538,7 +553,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2232bv64) == 1bv8); free requires (memory_load8_le(mem, 2233bv64) == 0bv8); @@ -679,7 +694,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2232bv64) == 1bv8); free requires (memory_load8_le(mem, 2233bv64) == 0bv8); diff --git a/src/test/correct/multi_malloc/clang_pic/multi_malloc.expected b/src/test/correct/multi_malloc/clang_pic/multi_malloc.expected index d210207e2..86eef3bee 100644 --- a/src/test/correct/multi_malloc/clang_pic/multi_malloc.expected +++ b/src/test/correct/multi_malloc/clang_pic/multi_malloc.expected @@ -1,83 +1,83 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2232bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2232bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -151,7 +151,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -160,12 +160,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2232bv64) == 1bv8); free requires (memory_load8_le(mem, 2233bv64) == 0bv8); @@ -306,7 +306,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69688bv64) == 0bv8); free requires (memory_load8_le(mem, 69689bv64) == 0bv8); @@ -467,41 +467,52 @@ procedure main() free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x818"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x818"}true; R29, Gamma_R29 := bvadd64(R31, 32bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); + assume {:captureState "addr:0x828"}true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000aa7; l00000aa7: + assume {:captureState "addr:0x834"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); + assume {:captureState "addr:0x834"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2112bv64, true; call malloc(); goto l00000abb; l00000abb: + assume {:captureState "addr:0x840"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x840"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x84c"}true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x858"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -511,6 +522,7 @@ procedure main() call printf(); goto l00000b0c; l00000b0c: + assume {:captureState "addr:0x870"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -520,16 +532,19 @@ procedure main() call printf(); goto l00000b2c; l00000b2c: + assume {:captureState "addr:0x884"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2188bv64, true; call #free(); goto l00000b3b; l00000b3b: + assume {:captureState "addr:0x88c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2196bv64, true; call #free(); goto l00000b49; l00000b49: + assume {:captureState "addr:0x894"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -538,7 +553,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2232bv64) == 1bv8); free requires (memory_load8_le(mem, 2233bv64) == 0bv8); @@ -679,7 +694,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2232bv64) == 1bv8); free requires (memory_load8_le(mem, 2233bv64) == 0bv8); diff --git a/src/test/correct/multi_malloc/gcc/multi_malloc.expected b/src/test/correct/multi_malloc/gcc/multi_malloc.expected index 5d260845c..9897cd900 100644 --- a/src/test/correct/multi_malloc/gcc/multi_malloc.expected +++ b/src/test/correct/multi_malloc/gcc/multi_malloc.expected @@ -1,79 +1,79 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2224bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2224bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -158,7 +158,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -167,12 +167,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2224bv64) == 1bv8); free requires (memory_load8_le(mem, 2225bv64) == 0bv8); @@ -335,7 +335,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -518,12 +518,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x814"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x814"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -531,23 +534,29 @@ procedure main() call malloc(); goto l00000357; l00000357: + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); + assume {:captureState "addr:0x824"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2096bv64, true; call malloc(); goto l0000036b; l0000036b: + assume {:captureState "addr:0x830"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x830"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x83c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x848"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -558,6 +567,7 @@ procedure main() call printf(); goto l000003c2; l000003c2: + assume {:captureState "addr:0x864"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -568,16 +578,19 @@ procedure main() call printf(); goto l000003e8; l000003e8: + assume {:captureState "addr:0x87c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2180bv64, true; call #free(); goto l000003f7; l000003f7: + assume {:captureState "addr:0x884"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 2188bv64, true; call #free(); goto l00000405; l00000405: + assume {:captureState "addr:0x88c"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -585,7 +598,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2224bv64) == 1bv8); free requires (memory_load8_le(mem, 2225bv64) == 0bv8); @@ -748,7 +761,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2224bv64) == 1bv8); free requires (memory_load8_le(mem, 2225bv64) == 0bv8); diff --git a/src/test/correct/multi_malloc/gcc_O2/multi_malloc.expected b/src/test/correct/multi_malloc/gcc_O2/multi_malloc.expected index bdf5f4cde..b456c480d 100644 --- a/src/test/correct/multi_malloc/gcc_O2/multi_malloc.expected +++ b/src/test/correct/multi_malloc/gcc_O2/multi_malloc.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2024bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R2: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2024bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -126,7 +126,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -135,12 +135,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure __printf_chk(); +procedure __printf_chk(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2024bv64) == 1bv8); free requires (memory_load8_le(mem, 2025bv64) == 0bv8); @@ -303,7 +303,7 @@ procedure __printf_chk(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R2, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R1, R16, R17, R2, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -486,12 +486,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv64; - var Gamma_#1: bool; + var #1: bv64; + var Gamma_#1: bool; lmain: + assume {:captureState "addr:0x680"}true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); + assume {:captureState "addr:0x680"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#1, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#1, 8bv64), Gamma_R30); + assume {:captureState "addr:0x680"}true; R31, Gamma_R31 := #1, Gamma_#1; R2, Gamma_R2 := 65bv64, true; R1, Gamma_R1 := 0bv64, true; @@ -502,6 +505,7 @@ procedure main() call __printf_chk(); goto l000001e1; l000001e1: + assume {:captureState "addr:0x69c"}true; R2, Gamma_R2 := 42bv64, true; R1, Gamma_R1 := 0bv64, true; R0, Gamma_R0 := 1bv64, true; @@ -510,6 +514,7 @@ procedure main() call __printf_chk(); goto l000001fd; l000001fd: + assume {:captureState "addr:0x6b0"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/multi_malloc/gcc_no_plt_no_pic/multi_malloc.expected b/src/test/correct/multi_malloc/gcc_no_plt_no_pic/multi_malloc.expected index 091f35ef7..7c5417b45 100644 --- a/src/test/correct/multi_malloc/gcc_no_plt_no_pic/multi_malloc.expected +++ b/src/test/correct/multi_malloc/gcc_no_plt_no_pic/multi_malloc.expected @@ -1,79 +1,79 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2224bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2224bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -158,7 +158,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -167,12 +167,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2224bv64) == 1bv8); free requires (memory_load8_le(mem, 2225bv64) == 0bv8); @@ -335,7 +335,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -518,12 +518,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x814"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x814"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -531,23 +534,29 @@ procedure main() call malloc(); goto l00000a64; l00000a64: + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); + assume {:captureState "addr:0x824"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2096bv64, true; call malloc(); goto l00000a78; l00000a78: + assume {:captureState "addr:0x830"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x830"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x83c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x848"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -558,6 +567,7 @@ procedure main() call printf(); goto l00000acf; l00000acf: + assume {:captureState "addr:0x864"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -568,16 +578,19 @@ procedure main() call printf(); goto l00000af5; l00000af5: + assume {:captureState "addr:0x87c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2180bv64, true; call #free(); goto l00000b04; l00000b04: + assume {:captureState "addr:0x884"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 2188bv64, true; call #free(); goto l00000b12; l00000b12: + assume {:captureState "addr:0x88c"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -585,7 +598,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2224bv64) == 1bv8); free requires (memory_load8_le(mem, 2225bv64) == 0bv8); @@ -748,7 +761,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2224bv64) == 1bv8); free requires (memory_load8_le(mem, 2225bv64) == 0bv8); diff --git a/src/test/correct/multi_malloc/gcc_pic/multi_malloc.expected b/src/test/correct/multi_malloc/gcc_pic/multi_malloc.expected index 091f35ef7..7c5417b45 100644 --- a/src/test/correct/multi_malloc/gcc_pic/multi_malloc.expected +++ b/src/test/correct/multi_malloc/gcc_pic/multi_malloc.expected @@ -1,79 +1,79 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 2224bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 2224bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -158,7 +158,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -167,12 +167,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure #free(); +procedure #free(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2224bv64) == 1bv8); free requires (memory_load8_le(mem, 2225bv64) == 0bv8); @@ -335,7 +335,7 @@ procedure #free(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R16, R17, R29, R30, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -518,12 +518,15 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x814"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x814"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x814"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -531,23 +534,29 @@ procedure main() call malloc(); goto l00000a64; l00000a64: + assume {:captureState "addr:0x824"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); + assume {:captureState "addr:0x824"}true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2096bv64, true; call malloc(); goto l00000a78; l00000a78: + assume {:captureState "addr:0x830"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x830"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x83c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x848"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -558,6 +567,7 @@ procedure main() call printf(); goto l00000acf; l00000acf: + assume {:captureState "addr:0x864"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -568,16 +578,19 @@ procedure main() call printf(); goto l00000af5; l00000af5: + assume {:captureState "addr:0x87c"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2180bv64, true; call #free(); goto l00000b04; l00000b04: + assume {:captureState "addr:0x884"}true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 2188bv64, true; call #free(); goto l00000b12; l00000b12: + assume {:captureState "addr:0x88c"}true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -585,7 +598,7 @@ procedure main() return; } -procedure malloc(); +procedure malloc(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2224bv64) == 1bv8); free requires (memory_load8_le(mem, 2225bv64) == 0bv8); @@ -748,7 +761,7 @@ procedure malloc(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure printf(); +procedure printf(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 2224bv64) == 1bv8); free requires (memory_load8_le(mem, 2225bv64) == 0bv8); diff --git a/src/test/correct/nestedif/clang/nestedif.expected b/src/test/correct/nestedif/clang/nestedif.expected index f67fbb5c7..5abf39619 100644 --- a/src/test/correct/nestedif/clang/nestedif.expected +++ b/src/test/correct/nestedif/clang/nestedif.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1968bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1968bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -188,26 +188,30 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x720"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), true); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 0bv33))), (Gamma_R8 && Gamma_#4); @@ -233,6 +237,7 @@ procedure main() } goto l00000442; l00000387: + assume {:captureState "addr:0x748"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R8[32:0], 4294967294bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934591bv33))), (Gamma_R8 && Gamma_#5); @@ -258,6 +263,7 @@ procedure main() } goto l0000042d; l000003c0: + assume {:captureState "addr:0x768"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #6, Gamma_#6 := bvadd32(R8[32:0], 4294967293bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934590bv33))), (Gamma_R8 && Gamma_#6); @@ -283,28 +289,40 @@ procedure main() } goto l00000418; l00000418: + assume {:captureState "addr:0x778"}true; goto l00000419; l00000419: + assume {:captureState "addr:0x77c"}true; R8, Gamma_R8 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x780"}true; goto l000003f9; l000003f9: + assume {:captureState "addr:0x788"}true; goto l000003ff; l0000042d: + assume {:captureState "addr:0x758"}true; goto l0000042e; l0000042e: + assume {:captureState "addr:0x75c"}true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x760"}true; goto l000003ff; l000003ff: + assume {:captureState "addr:0x78c"}true; goto l00000403; l00000442: + assume {:captureState "addr:0x738"}true; goto l00000443; l00000443: + assume {:captureState "addr:0x73c"}true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x740"}true; goto l00000403; l00000403: + assume {:captureState "addr:0x790"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/nestedif/clang_O2/nestedif.expected b/src/test/correct/nestedif/clang_O2/nestedif.expected index 5f6aef7e1..863d7bd46 100644 --- a/src/test/correct/nestedif/clang_O2/nestedif.expected +++ b/src/test/correct/nestedif/clang_O2/nestedif.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1840bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1840bv64); +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -155,6 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/nestedif/clang_no_plt_no_pic/nestedif.expected b/src/test/correct/nestedif/clang_no_plt_no_pic/nestedif.expected index 414246d3e..a11142224 100644 --- a/src/test/correct/nestedif/clang_no_plt_no_pic/nestedif.expected +++ b/src/test/correct/nestedif/clang_no_plt_no_pic/nestedif.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1968bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1968bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -188,26 +188,30 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x720"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), true); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 0bv33))), (Gamma_R8 && Gamma_#4); @@ -233,6 +237,7 @@ procedure main() } goto l00000b73; l00000ab8: + assume {:captureState "addr:0x748"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R8[32:0], 4294967294bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934591bv33))), (Gamma_R8 && Gamma_#5); @@ -258,6 +263,7 @@ procedure main() } goto l00000b5e; l00000af1: + assume {:captureState "addr:0x768"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #6, Gamma_#6 := bvadd32(R8[32:0], 4294967293bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934590bv33))), (Gamma_R8 && Gamma_#6); @@ -283,28 +289,40 @@ procedure main() } goto l00000b49; l00000b49: + assume {:captureState "addr:0x778"}true; goto l00000b4a; l00000b4a: + assume {:captureState "addr:0x77c"}true; R8, Gamma_R8 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x780"}true; goto l00000b2a; l00000b2a: + assume {:captureState "addr:0x788"}true; goto l00000b30; l00000b5e: + assume {:captureState "addr:0x758"}true; goto l00000b5f; l00000b5f: + assume {:captureState "addr:0x75c"}true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x760"}true; goto l00000b30; l00000b30: + assume {:captureState "addr:0x78c"}true; goto l00000b34; l00000b73: + assume {:captureState "addr:0x738"}true; goto l00000b74; l00000b74: + assume {:captureState "addr:0x73c"}true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x740"}true; goto l00000b34; l00000b34: + assume {:captureState "addr:0x790"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/nestedif/clang_pic/nestedif.expected b/src/test/correct/nestedif/clang_pic/nestedif.expected index 414246d3e..a11142224 100644 --- a/src/test/correct/nestedif/clang_pic/nestedif.expected +++ b/src/test/correct/nestedif/clang_pic/nestedif.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1968bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1968bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -188,26 +188,30 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x720"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), true); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 0bv33))), (Gamma_R8 && Gamma_#4); @@ -233,6 +237,7 @@ procedure main() } goto l00000b73; l00000ab8: + assume {:captureState "addr:0x748"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R8[32:0], 4294967294bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934591bv33))), (Gamma_R8 && Gamma_#5); @@ -258,6 +263,7 @@ procedure main() } goto l00000b5e; l00000af1: + assume {:captureState "addr:0x768"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #6, Gamma_#6 := bvadd32(R8[32:0], 4294967293bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934590bv33))), (Gamma_R8 && Gamma_#6); @@ -283,28 +289,40 @@ procedure main() } goto l00000b49; l00000b49: + assume {:captureState "addr:0x778"}true; goto l00000b4a; l00000b4a: + assume {:captureState "addr:0x77c"}true; R8, Gamma_R8 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x780"}true; goto l00000b2a; l00000b2a: + assume {:captureState "addr:0x788"}true; goto l00000b30; l00000b5e: + assume {:captureState "addr:0x758"}true; goto l00000b5f; l00000b5f: + assume {:captureState "addr:0x75c"}true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x760"}true; goto l00000b30; l00000b30: + assume {:captureState "addr:0x78c"}true; goto l00000b34; l00000b73: + assume {:captureState "addr:0x738"}true; goto l00000b74; l00000b74: + assume {:captureState "addr:0x73c"}true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x740"}true; goto l00000b34; l00000b34: + assume {:captureState "addr:0x790"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/nestedif/gcc/nestedif.expected b/src/test/correct/nestedif/gcc/nestedif.expected index cd8b37fae..e9ee57ce5 100644 --- a/src/test/correct/nestedif/gcc/nestedif.expected +++ b/src/test/correct/nestedif/gcc/nestedif.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1928bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1928bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,25 +186,28 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -217,6 +220,7 @@ procedure main() } goto l000003c4; l00000345: + assume {:captureState "addr:0x73c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#5); @@ -229,6 +233,7 @@ procedure main() } goto l000003b3; l0000036b: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#6); @@ -241,18 +246,25 @@ procedure main() } goto l000003a6; l000003a6: + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x764"}true; goto l00000391; l000003b3: + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x74c"}true; goto l00000391; l000003c4: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x734"}true; goto l00000391; l00000391: + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/nestedif/gcc_O2/nestedif.expected b/src/test/correct/nestedif/gcc_O2/nestedif.expected index 2eddd390b..418f9a5da 100644 --- a/src/test/correct/nestedif/gcc_O2/nestedif.expected +++ b/src/test/correct/nestedif/gcc_O2/nestedif.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1896bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1896bv64); +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -155,6 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/nestedif/gcc_no_plt_no_pic/nestedif.expected b/src/test/correct/nestedif/gcc_no_plt_no_pic/nestedif.expected index 33c35d1e9..0980d9726 100644 --- a/src/test/correct/nestedif/gcc_no_plt_no_pic/nestedif.expected +++ b/src/test/correct/nestedif/gcc_no_plt_no_pic/nestedif.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1928bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1928bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,25 +186,28 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -217,6 +220,7 @@ procedure main() } goto l00000a60; l000009e1: + assume {:captureState "addr:0x73c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#5); @@ -229,6 +233,7 @@ procedure main() } goto l00000a4f; l00000a07: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#6); @@ -241,18 +246,25 @@ procedure main() } goto l00000a42; l00000a42: + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x764"}true; goto l00000a2d; l00000a4f: + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x74c"}true; goto l00000a2d; l00000a60: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x734"}true; goto l00000a2d; l00000a2d: + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/nestedif/gcc_pic/nestedif.expected b/src/test/correct/nestedif/gcc_pic/nestedif.expected index 33c35d1e9..0980d9726 100644 --- a/src/test/correct/nestedif/gcc_pic/nestedif.expected +++ b/src/test/correct/nestedif/gcc_pic/nestedif.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1928bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1928bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,25 +186,28 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -217,6 +220,7 @@ procedure main() } goto l00000a60; l000009e1: + assume {:captureState "addr:0x73c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#5); @@ -229,6 +233,7 @@ procedure main() } goto l00000a4f; l00000a07: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#6); @@ -241,18 +246,25 @@ procedure main() } goto l00000a42; l00000a42: + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x764"}true; goto l00000a2d; l00000a4f: + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x74c"}true; goto l00000a2d; l00000a60: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x734"}true; goto l00000a2d; l00000a2d: + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/no_interference_update_x/clang/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/clang/no_interference_update_x.expected index 65df4fefc..02cb1d620 100644 --- a/src/test/correct/no_interference_update_x/clang/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/clang/no_interference_update_x.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -80,18 +80,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -183,8 +183,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var y_old: bv32; + var y_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -192,6 +193,7 @@ procedure main() y_old := memory_load32_le(mem, $y_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert (memory_load32_le(mem, $y_addr) == y_old); + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_x/clang_O2/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/clang_O2/no_interference_update_x.expected index 65fd3db2f..9eb531be8 100644 --- a/src/test/correct/no_interference_update_x/clang_O2/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/clang_O2/no_interference_update_x.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -80,18 +80,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -183,8 +183,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var y_old: bv32; + var y_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -193,5 +194,6 @@ procedure main() y_old := memory_load32_le(mem, $y_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); assert (memory_load32_le(mem, $y_addr) == y_old); + assume {:captureState "addr:0x720"}true; return; } diff --git a/src/test/correct/no_interference_update_x/clang_no_plt_no_pic/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/clang_no_plt_no_pic/no_interference_update_x.expected index 65df4fefc..02cb1d620 100644 --- a/src/test/correct/no_interference_update_x/clang_no_plt_no_pic/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/clang_no_plt_no_pic/no_interference_update_x.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -80,18 +80,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -183,8 +183,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var y_old: bv32; + var y_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -192,6 +193,7 @@ procedure main() y_old := memory_load32_le(mem, $y_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert (memory_load32_le(mem, $y_addr) == y_old); + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_x/clang_pic/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/clang_pic/no_interference_update_x.expected index cb8100cda..d0ee9ad05 100644 --- a/src/test/correct/no_interference_update_x/clang_pic/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/clang_pic/no_interference_update_x.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -88,7 +88,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -96,18 +96,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -215,8 +215,9 @@ procedure main() free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { - var y_old: bv32; + var y_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); @@ -226,6 +227,7 @@ procedure main() y_old := memory_load32_le(mem, $y_addr); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert (memory_load32_le(mem, $y_addr) == y_old); + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_x/gcc/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/gcc/no_interference_update_x.expected index 5ddfad626..d3d6c65d5 100644 --- a/src/test/correct/no_interference_update_x/gcc/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/gcc/no_interference_update_x.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -78,18 +78,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -181,8 +181,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var y_old: bv32; + var y_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -191,6 +192,7 @@ procedure main() y_old := memory_load32_le(mem, $y_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (memory_load32_le(mem, $y_addr) == y_old); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_x/gcc_O2/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/gcc_O2/no_interference_update_x.expected index 59cdf8a8b..ba8f09dd7 100644 --- a/src/test/correct/no_interference_update_x/gcc_O2/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/gcc_O2/no_interference_update_x.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -80,18 +80,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -183,8 +183,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var y_old: bv32; + var y_old: bv32; lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 1bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -193,5 +194,6 @@ procedure main() y_old := memory_load32_le(mem, $y_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R2); assert (memory_load32_le(mem, $y_addr) == y_old); + assume {:captureState "addr:0x60c"}true; return; } diff --git a/src/test/correct/no_interference_update_x/gcc_no_plt_no_pic/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/gcc_no_plt_no_pic/no_interference_update_x.expected index 5ddfad626..d3d6c65d5 100644 --- a/src/test/correct/no_interference_update_x/gcc_no_plt_no_pic/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/gcc_no_plt_no_pic/no_interference_update_x.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -78,18 +78,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -181,8 +181,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var y_old: bv32; + var y_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -191,6 +192,7 @@ procedure main() y_old := memory_load32_le(mem, $y_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (memory_load32_le(mem, $y_addr) == y_old); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_x/gcc_pic/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/gcc_pic/no_interference_update_x.expected index d687a5a76..66100cb2c 100644 --- a/src/test/correct/no_interference_update_x/gcc_pic/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/gcc_pic/no_interference_update_x.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -86,7 +86,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -94,18 +94,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -213,8 +213,9 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var y_old: bv32; + var y_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -224,6 +225,7 @@ procedure main() y_old := memory_load32_le(mem, $y_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (memory_load32_le(mem, $y_addr) == y_old); + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_y/clang/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/clang/no_interference_update_y.expected index 97e3a6585..f5d1eaace 100644 --- a/src/test/correct/no_interference_update_y/clang/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/clang/no_interference_update_y.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -80,18 +80,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -183,8 +183,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -192,6 +193,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert (memory_load32_le(mem, $x_addr) == x_old); + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_y/clang_O2/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/clang_O2/no_interference_update_y.expected index 87f71c5c0..6f021c8f0 100644 --- a/src/test/correct/no_interference_update_y/clang_O2/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/clang_O2/no_interference_update_y.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -80,18 +80,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -183,8 +183,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -193,5 +194,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); assert (memory_load32_le(mem, $x_addr) == x_old); + assume {:captureState "addr:0x720"}true; return; } diff --git a/src/test/correct/no_interference_update_y/clang_no_plt_no_pic/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/clang_no_plt_no_pic/no_interference_update_y.expected index 97e3a6585..f5d1eaace 100644 --- a/src/test/correct/no_interference_update_y/clang_no_plt_no_pic/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/clang_no_plt_no_pic/no_interference_update_y.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -80,18 +80,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -183,8 +183,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -192,6 +193,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert (memory_load32_le(mem, $x_addr) == x_old); + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_y/clang_pic/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/clang_pic/no_interference_update_y.expected index e4d7d7452..69562d75e 100644 --- a/src/test/correct/no_interference_update_y/clang_pic/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/clang_pic/no_interference_update_y.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -88,7 +88,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -96,18 +96,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -215,8 +215,9 @@ procedure main() free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4048bv64)) || L(mem, bvadd64(R9, 4048bv64))); @@ -226,6 +227,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert (memory_load32_le(mem, $x_addr) == x_old); + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_y/gcc/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/gcc/no_interference_update_y.expected index 794548339..5567fed6b 100644 --- a/src/test/correct/no_interference_update_y/gcc/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/gcc/no_interference_update_y.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -78,18 +78,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -181,8 +181,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -191,6 +192,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (memory_load32_le(mem, $x_addr) == x_old); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_y/gcc_O2/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/gcc_O2/no_interference_update_y.expected index dfdfc1b45..42731f16f 100644 --- a/src/test/correct/no_interference_update_y/gcc_O2/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/gcc_O2/no_interference_update_y.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69656bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69656bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -80,18 +80,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -183,8 +183,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 1bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -193,5 +194,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R2); assert (memory_load32_le(mem, $x_addr) == x_old); + assume {:captureState "addr:0x60c"}true; return; } diff --git a/src/test/correct/no_interference_update_y/gcc_no_plt_no_pic/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/gcc_no_plt_no_pic/no_interference_update_y.expected index 794548339..5567fed6b 100644 --- a/src/test/correct/no_interference_update_y/gcc_no_plt_no_pic/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/gcc_no_plt_no_pic/no_interference_update_y.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -78,18 +78,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -181,8 +181,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -191,6 +192,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (memory_load32_le(mem, $x_addr) == x_old); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_y/gcc_pic/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/gcc_pic/no_interference_update_y.expected index 227bf3abe..211747e8a 100644 --- a/src/test/correct/no_interference_update_y/gcc_pic/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/gcc_pic/no_interference_update_y.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; -axiom {:extern } ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$y_addr: bv64; +axiom {:extern }($y_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -86,7 +86,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -94,18 +94,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -213,8 +213,9 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var x_old: bv32; + var x_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -224,6 +225,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (memory_load32_le(mem, $x_addr) == x_old); + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/secret_write/clang/secret_write.expected b/src/test/correct/secret_write/clang/secret_write.expected index b90e31b4a..034422fdf 100644 --- a/src/test/correct/secret_write/clang/secret_write.expected +++ b/src/test/correct/secret_write/clang/secret_write.expected @@ -1,49 +1,49 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69688bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69692bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69688bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69692bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"}bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"}bvsmod32(bv32, bv32) returns (bv32); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -94,19 +94,19 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R8, R9, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $z_addr) == true); @@ -201,9 +201,10 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); @@ -213,6 +214,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), true); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x71c"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R9, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R9, 52bv64)) || L(mem, bvadd64(R9, 52bv64))); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; @@ -223,6 +225,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x728"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R10, Gamma_R10 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); @@ -234,6 +237,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 60bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 60bv64), Gamma_R10); assert ((bvadd64(R8, 60bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x738"}true; call rely(); assert (L(mem, bvadd64(R8, 60bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); @@ -241,6 +245,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 60bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 60bv64), true); assert ((bvadd64(R8, 60bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x73c"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R9, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R9, 52bv64)) || L(mem, bvadd64(R9, 52bv64))); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; @@ -251,5 +256,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x748"}true; return; } diff --git a/src/test/correct/secret_write/clang_O2/secret_write.expected b/src/test/correct/secret_write/clang_O2/secret_write.expected index 30ca2a333..225c6b7b6 100644 --- a/src/test/correct/secret_write/clang_O2/secret_write.expected +++ b/src/test/correct/secret_write/clang_O2/secret_write.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69688bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69692bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69688bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69692bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"}bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"}bvsmod32(bv32, bv32) returns (bv32); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -92,19 +92,19 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R8, R9, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $z_addr) == true); @@ -199,9 +199,10 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; @@ -213,6 +214,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 60bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 60bv64), true); assert ((bvadd64(R8, 60bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x724"}true; call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R10); z_old := memory_load32_le(mem, $z_addr); @@ -220,5 +222,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R10); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x728"}true; return; } diff --git a/src/test/correct/secret_write/clang_no_plt_no_pic/secret_write.expected b/src/test/correct/secret_write/clang_no_plt_no_pic/secret_write.expected index b90e31b4a..034422fdf 100644 --- a/src/test/correct/secret_write/clang_no_plt_no_pic/secret_write.expected +++ b/src/test/correct/secret_write/clang_no_plt_no_pic/secret_write.expected @@ -1,49 +1,49 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69688bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69692bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69688bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69692bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"}bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"}bvsmod32(bv32, bv32) returns (bv32); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -94,19 +94,19 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R8, R9, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $z_addr) == true); @@ -201,9 +201,10 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); @@ -213,6 +214,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), true); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x71c"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R9, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R9, 52bv64)) || L(mem, bvadd64(R9, 52bv64))); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; @@ -223,6 +225,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x728"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R10, Gamma_R10 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); @@ -234,6 +237,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 60bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 60bv64), Gamma_R10); assert ((bvadd64(R8, 60bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x738"}true; call rely(); assert (L(mem, bvadd64(R8, 60bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); @@ -241,6 +245,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 60bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 60bv64), true); assert ((bvadd64(R8, 60bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x73c"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R9, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R9, 52bv64)) || L(mem, bvadd64(R9, 52bv64))); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; @@ -251,5 +256,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x748"}true; return; } diff --git a/src/test/correct/secret_write/clang_pic/secret_write.expected b/src/test/correct/secret_write/clang_pic/secret_write.expected index d367354d4..4baf62826 100644 --- a/src/test/correct/secret_write/clang_pic/secret_write.expected +++ b/src/test/correct/secret_write/clang_pic/secret_write.expected @@ -1,57 +1,57 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69688bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69692bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69688bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69692bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"}bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"}bvsmod32(bv32, bv32) returns (bv32); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -117,7 +117,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69566bv64) == 0bv8); free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -126,19 +126,19 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R8, R9, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $z_addr) == true); @@ -281,9 +281,10 @@ procedure main() free ensures (memory_load8_le(mem, 69566bv64) == 0bv8); free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4024bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4024bv64)) || L(mem, bvadd64(R9, 4024bv64))); @@ -295,6 +296,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R9, 0bv32), gamma_store32(Gamma_mem, R9, true); assert ((R9 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x760"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R9)), (gamma_load32(Gamma_mem, R9) || L(mem, R9)); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; @@ -305,6 +307,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert ((R9 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x76c"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4048bv64)) || L(mem, bvadd64(R8, 4048bv64))); @@ -320,6 +323,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R8, R10[32:0]), gamma_store32(Gamma_mem, R8, Gamma_R10); assert ((R8 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x784"}true; call rely(); assert (L(mem, R8) ==> true); z_old := memory_load32_le(mem, $z_addr); @@ -327,6 +331,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R8, 0bv32), gamma_store32(Gamma_mem, R8, true); assert ((R8 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x788"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R9)), (gamma_load32(Gamma_mem, R9) || L(mem, R9)); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; @@ -337,5 +342,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert ((R9 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x794"}true; return; } diff --git a/src/test/correct/secret_write/gcc/secret_write.expected b/src/test/correct/secret_write/gcc/secret_write.expected index 4dfd5ef1f..80e69648c 100644 --- a/src/test/correct/secret_write/gcc/secret_write.expected +++ b/src/test/correct/secret_write/gcc/secret_write.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69660bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69656bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69660bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69656bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"}bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"}bvsmod32(bv32, bv32) returns (bv32); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -90,19 +90,19 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $z_addr) == true); @@ -197,9 +197,10 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -209,6 +210,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -223,6 +225,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 28bv64), Gamma_R0; call rely(); @@ -236,6 +239,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x750"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -245,6 +249,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x75c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -259,6 +264,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/secret_write/gcc_O2/secret_write.expected b/src/test/correct/secret_write/gcc_O2/secret_write.expected index bba53ca31..fc00e6e23 100644 --- a/src/test/correct/secret_write/gcc_O2/secret_write.expected +++ b/src/test/correct/secret_write/gcc_O2/secret_write.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R3: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R3: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69660bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_R3: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }R3: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69660bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"}bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"}bvsmod32(bv32, bv32) returns (bv32); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -92,19 +92,19 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_R3, Gamma_mem, R0, R1, R2, R3, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $z_addr) == true); @@ -199,9 +199,10 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R3, Gamma_R3 := 2bv64, true; @@ -213,6 +214,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), true); assert ((bvadd64(R1, 20bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x610"}true; call rely(); assert (L(mem, bvadd64(R2, 4bv64)) ==> Gamma_R3); z_old := memory_load32_le(mem, $z_addr); @@ -220,5 +222,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R2, 4bv64), R3[32:0]), gamma_store32(Gamma_mem, bvadd64(R2, 4bv64), Gamma_R3); assert ((bvadd64(R2, 4bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x614"}true; return; } diff --git a/src/test/correct/secret_write/gcc_no_plt_no_pic/secret_write.expected b/src/test/correct/secret_write/gcc_no_plt_no_pic/secret_write.expected index 4dfd5ef1f..80e69648c 100644 --- a/src/test/correct/secret_write/gcc_no_plt_no_pic/secret_write.expected +++ b/src/test/correct/secret_write/gcc_no_plt_no_pic/secret_write.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69660bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69656bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69660bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69656bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"}bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"}bvsmod32(bv32, bv32) returns (bv32); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -90,19 +90,19 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $z_addr) == true); @@ -197,9 +197,10 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -209,6 +210,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -223,6 +225,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 28bv64), Gamma_R0; call rely(); @@ -236,6 +239,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x750"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -245,6 +249,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x75c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -259,6 +264,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/secret_write/gcc_pic/secret_write.expected b/src/test/correct/secret_write/gcc_pic/secret_write.expected index dfa86e408..dfdaf6ea3 100644 --- a/src/test/correct/secret_write/gcc_pic/secret_write.expected +++ b/src/test/correct/secret_write/gcc_pic/secret_write.expected @@ -1,53 +1,53 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69660bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69656bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69660bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69656bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"}bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"}bvsmod32(bv32, bv32) returns (bv32); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -113,7 +113,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -122,19 +122,19 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); requires (gamma_load32(Gamma_mem, $z_addr) == true); @@ -277,9 +277,10 @@ procedure main() free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); { - var Gamma_x_old: bool; - var z_old: bv32; + var Gamma_x_old: bool; + var z_old: bv32; lmain: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4048bv64)) || L(mem, bvadd64(R0, 4048bv64))); @@ -290,6 +291,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x75c"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4048bv64)) || L(mem, bvadd64(R0, 4048bv64))); @@ -306,6 +308,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -321,6 +324,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x790"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -331,6 +335,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x79c"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4048bv64)) || L(mem, bvadd64(R0, 4048bv64))); @@ -347,6 +352,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); + assume {:captureState "addr:0x7b8"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/simple_jump/clang/simple_jump.expected b/src/test/correct/simple_jump/clang/simple_jump.expected index 02618c076..32e9685b4 100644 --- a/src/test/correct/simple_jump/clang/simple_jump.expected +++ b/src/test/correct/simple_jump/clang/simple_jump.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1892bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1892bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -188,21 +188,24 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x720"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967290bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934587bv33))), (Gamma_R8 && Gamma_#4); @@ -228,12 +231,16 @@ procedure main() } goto l0000034b; l0000034b: + assume {:captureState "addr:0x734"}true; goto l0000034c; l0000034c: + assume {:captureState "addr:0x738"}true; R8, Gamma_R8 := 6bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x73c"}true; goto l00000334; l00000334: + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/simple_jump/clang_O2/simple_jump.expected b/src/test/correct/simple_jump/clang_O2/simple_jump.expected index 5f6aef7e1..863d7bd46 100644 --- a/src/test/correct/simple_jump/clang_O2/simple_jump.expected +++ b/src/test/correct/simple_jump/clang_O2/simple_jump.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1840bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1840bv64); +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -155,6 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/simple_jump/clang_no_plt_no_pic/simple_jump.expected b/src/test/correct/simple_jump/clang_no_plt_no_pic/simple_jump.expected index f4abe0b1a..8090021a9 100644 --- a/src/test/correct/simple_jump/clang_no_plt_no_pic/simple_jump.expected +++ b/src/test/correct/simple_jump/clang_no_plt_no_pic/simple_jump.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1892bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1892bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -188,21 +188,24 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x720"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967290bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934587bv33))), (Gamma_R8 && Gamma_#4); @@ -228,12 +231,16 @@ procedure main() } goto l0000095d; l0000095d: + assume {:captureState "addr:0x734"}true; goto l0000095e; l0000095e: + assume {:captureState "addr:0x738"}true; R8, Gamma_R8 := 6bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x73c"}true; goto l00000946; l00000946: + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/simple_jump/clang_pic/simple_jump.expected b/src/test/correct/simple_jump/clang_pic/simple_jump.expected index f4abe0b1a..8090021a9 100644 --- a/src/test/correct/simple_jump/clang_pic/simple_jump.expected +++ b/src/test/correct/simple_jump/clang_pic/simple_jump.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1892bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1892bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -188,21 +188,24 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x720"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967290bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934587bv33))), (Gamma_R8 && Gamma_#4); @@ -228,12 +231,16 @@ procedure main() } goto l0000095d; l0000095d: + assume {:captureState "addr:0x734"}true; goto l0000095e; l0000095e: + assume {:captureState "addr:0x738"}true; R8, Gamma_R8 := 6bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x73c"}true; goto l00000946; l00000946: + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/simple_jump/gcc/simple_jump.expected b/src/test/correct/simple_jump/gcc/simple_jump.expected index 40ecd3f23..260f165dc 100644 --- a/src/test/correct/simple_jump/gcc/simple_jump.expected +++ b/src/test/correct/simple_jump/gcc/simple_jump.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1876bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1876bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,20 +186,22 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#4); @@ -212,10 +214,13 @@ procedure main() } goto l0000031f; l0000031f: + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := 6bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x730"}true; goto l0000030a; l0000030a: + assume {:captureState "addr:0x734"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/simple_jump/gcc_O2/simple_jump.expected b/src/test/correct/simple_jump/gcc_O2/simple_jump.expected index 2eddd390b..418f9a5da 100644 --- a/src/test/correct/simple_jump/gcc_O2/simple_jump.expected +++ b/src/test/correct/simple_jump/gcc_O2/simple_jump.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1896bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1896bv64); +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,12 +58,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -155,6 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/simple_jump/gcc_no_plt_no_pic/simple_jump.expected b/src/test/correct/simple_jump/gcc_no_plt_no_pic/simple_jump.expected index 062719163..fd5d1056b 100644 --- a/src/test/correct/simple_jump/gcc_no_plt_no_pic/simple_jump.expected +++ b/src/test/correct/simple_jump/gcc_no_plt_no_pic/simple_jump.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1876bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1876bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,20 +186,22 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#4); @@ -212,10 +214,13 @@ procedure main() } goto l000008f6; l000008f6: + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := 6bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x730"}true; goto l000008e1; l000008e1: + assume {:captureState "addr:0x734"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/simple_jump/gcc_pic/simple_jump.expected b/src/test/correct/simple_jump/gcc_pic/simple_jump.expected index 062719163..fd5d1056b 100644 --- a/src/test/correct/simple_jump/gcc_pic/simple_jump.expected +++ b/src/test/correct/simple_jump/gcc_pic/simple_jump.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1876bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1876bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,20 +186,22 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#4); @@ -212,10 +214,13 @@ procedure main() } goto l000008f6; l000008f6: + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := 6bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x730"}true; goto l000008e1; l000008e1: + assume {:captureState "addr:0x734"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/switch/clang/switch.expected b/src/test/correct/switch/clang/switch.expected index 6f7e9c47f..5d685847f 100644 --- a/src/test/correct/switch/clang/switch.expected +++ b/src/test/correct/switch/clang/switch.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1936bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1936bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R31, Gamma_R8, Gamma_stack, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -186,25 +186,29 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); + assume {:captureState "addr:0x720"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x728"}true; #4, Gamma_#4 := bvadd32(R8[32:0], 4294967294bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934591bv33))), (Gamma_R8 && Gamma_#4); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#4, 1bv32)), bvadd33(zero_extend1_32(R8[32:0]), 4294967295bv33))), (Gamma_R8 && Gamma_#4); @@ -229,8 +233,10 @@ procedure main() } goto l0000039a; l0000039a: + assume {:captureState "addr:0x738"}true; goto l0000039b; l0000039b: + assume {:captureState "addr:0x73c"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #5, Gamma_#5 := bvadd32(R8[32:0], 4294967292bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934589bv33))), (Gamma_R8 && Gamma_#5); @@ -256,20 +262,28 @@ procedure main() } goto l000003d7; l00000389: + assume {:captureState "addr:0x768"}true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x76c"}true; goto l0000037b; l000003d7: + assume {:captureState "addr:0x74c"}true; goto l000003d8; l000003d8: + assume {:captureState "addr:0x750"}true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x754"}true; goto l00000368; l00000368: + assume {:captureState "addr:0x75c"}true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x760"}true; goto l0000037b; l0000037b: + assume {:captureState "addr:0x774"}true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/switch/clang_O2/switch.expected b/src/test/correct/switch/clang_O2/switch.expected index 91a00d7c9..6ca38a2b2 100644 --- a/src/test/correct/switch/clang_O2/switch.expected +++ b/src/test/correct/switch/clang_O2/switch.expected @@ -1,12 +1,12 @@ -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1836bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }mem: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1836bv64); +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -47,7 +47,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,12 +56,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); free requires (memory_load8_le(mem, 69666bv64) == 0bv8); @@ -152,5 +152,6 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; return; } diff --git a/src/test/correct/switch/clang_no_plt_no_pic/switch.expected b/src/test/correct/switch/clang_no_plt_no_pic/switch.expected index d1ad70d36..f59c57b1d 100644 --- a/src/test/correct/switch/clang_no_plt_no_pic/switch.expected +++ b/src/test/correct/switch/clang_no_plt_no_pic/switch.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1936bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1936bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R31, Gamma_R8, Gamma_stack, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -186,25 +186,29 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); + assume {:captureState "addr:0x720"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x728"}true; #4, Gamma_#4 := bvadd32(R8[32:0], 4294967294bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934591bv33))), (Gamma_R8 && Gamma_#4); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#4, 1bv32)), bvadd33(zero_extend1_32(R8[32:0]), 4294967295bv33))), (Gamma_R8 && Gamma_#4); @@ -229,8 +233,10 @@ procedure main() } goto l00000a4f; l00000a4f: + assume {:captureState "addr:0x738"}true; goto l00000a50; l00000a50: + assume {:captureState "addr:0x73c"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #5, Gamma_#5 := bvadd32(R8[32:0], 4294967292bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934589bv33))), (Gamma_R8 && Gamma_#5); @@ -256,20 +262,28 @@ procedure main() } goto l00000a8c; l00000a3e: + assume {:captureState "addr:0x768"}true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x76c"}true; goto l00000a30; l00000a8c: + assume {:captureState "addr:0x74c"}true; goto l00000a8d; l00000a8d: + assume {:captureState "addr:0x750"}true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x754"}true; goto l00000a1d; l00000a1d: + assume {:captureState "addr:0x75c"}true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x760"}true; goto l00000a30; l00000a30: + assume {:captureState "addr:0x774"}true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/switch/clang_pic/switch.expected b/src/test/correct/switch/clang_pic/switch.expected index d1ad70d36..f59c57b1d 100644 --- a/src/test/correct/switch/clang_pic/switch.expected +++ b/src/test/correct/switch/clang_pic/switch.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1936bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1936bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R31, Gamma_R8, Gamma_stack, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -186,25 +186,29 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); + assume {:captureState "addr:0x720"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x728"}true; #4, Gamma_#4 := bvadd32(R8[32:0], 4294967294bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934591bv33))), (Gamma_R8 && Gamma_#4); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#4, 1bv32)), bvadd33(zero_extend1_32(R8[32:0]), 4294967295bv33))), (Gamma_R8 && Gamma_#4); @@ -229,8 +233,10 @@ procedure main() } goto l00000a4f; l00000a4f: + assume {:captureState "addr:0x738"}true; goto l00000a50; l00000a50: + assume {:captureState "addr:0x73c"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #5, Gamma_#5 := bvadd32(R8[32:0], 4294967292bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934589bv33))), (Gamma_R8 && Gamma_#5); @@ -256,20 +262,28 @@ procedure main() } goto l00000a8c; l00000a3e: + assume {:captureState "addr:0x768"}true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x76c"}true; goto l00000a30; l00000a8c: + assume {:captureState "addr:0x74c"}true; goto l00000a8d; l00000a8d: + assume {:captureState "addr:0x750"}true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x754"}true; goto l00000a1d; l00000a1d: + assume {:captureState "addr:0x75c"}true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x760"}true; goto l00000a30; l00000a30: + assume {:captureState "addr:0x774"}true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/switch/gcc/switch.expected b/src/test/correct/switch/gcc/switch.expected index adc61ee66..7ed50a4be 100644 --- a/src/test/correct/switch/gcc/switch.expected +++ b/src/test/correct/switch/gcc/switch.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1916bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1916bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,23 +186,26 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#4); @@ -215,6 +218,7 @@ procedure main() } goto l0000036b; l0000036b: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#5); @@ -227,18 +231,25 @@ procedure main() } goto l00000391; l0000035c: + assume {:captureState "addr:0x750"}true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x754"}true; goto l0000034c; l00000391: + assume {:captureState "addr:0x73c"}true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x740"}true; goto l00000339; l00000339: + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x748"}true; goto l0000034c; l0000034c: + assume {:captureState "addr:0x75c"}true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/switch/gcc_O2/switch.expected b/src/test/correct/switch/gcc_O2/switch.expected index db9ab2b08..cf806e8fd 100644 --- a/src/test/correct/switch/gcc_O2/switch.expected +++ b/src/test/correct/switch/gcc_O2/switch.expected @@ -1,12 +1,12 @@ -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1896bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }mem: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1896bv64); +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -47,7 +47,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,12 +56,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); free requires (memory_load8_le(mem, 69634bv64) == 0bv8); @@ -152,5 +152,6 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; return; } diff --git a/src/test/correct/switch/gcc_no_plt_no_pic/switch.expected b/src/test/correct/switch/gcc_no_plt_no_pic/switch.expected index 4ebf8fed5..5418587da 100644 --- a/src/test/correct/switch/gcc_no_plt_no_pic/switch.expected +++ b/src/test/correct/switch/gcc_no_plt_no_pic/switch.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1916bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1916bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,23 +186,26 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#4); @@ -215,6 +218,7 @@ procedure main() } goto l000009ca; l000009ca: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#5); @@ -227,18 +231,25 @@ procedure main() } goto l000009f0; l000009bb: + assume {:captureState "addr:0x750"}true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x754"}true; goto l000009ab; l000009f0: + assume {:captureState "addr:0x73c"}true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x740"}true; goto l00000998; l00000998: + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x748"}true; goto l000009ab; l000009ab: + assume {:captureState "addr:0x75c"}true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/switch/gcc_pic/switch.expected b/src/test/correct/switch/gcc_pic/switch.expected index 4ebf8fed5..5418587da 100644 --- a/src/test/correct/switch/gcc_pic/switch.expected +++ b/src/test/correct/switch/gcc_pic/switch.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1916bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1916bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,23 +186,26 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#4); @@ -215,6 +218,7 @@ procedure main() } goto l000009ca; l000009ca: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#5); @@ -227,18 +231,25 @@ procedure main() } goto l000009f0; l000009bb: + assume {:captureState "addr:0x750"}true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x754"}true; goto l000009ab; l000009f0: + assume {:captureState "addr:0x73c"}true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x740"}true; goto l00000998; l00000998: + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x748"}true; goto l000009ab; l000009ab: + assume {:captureState "addr:0x75c"}true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/switch2/clang_O2/switch2.expected b/src/test/correct/switch2/clang_O2/switch2.expected index ed0d9f14a..fc05afa85 100644 --- a/src/test/correct/switch2/clang_O2/switch2.expected +++ b/src/test/correct/switch2/clang_O2/switch2.expected @@ -1,11 +1,11 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } mem: [bv64]bv8; -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }mem: [bv64]bv8; +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -46,7 +46,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -55,12 +55,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -152,5 +152,6 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x71c"}true; return; } diff --git a/src/test/correct/switch2/gcc/switch2.expected b/src/test/correct/switch2/gcc/switch2.expected index e5b0696b4..2dd4115fb 100644 --- a/src/test/correct/switch2/gcc/switch2.expected +++ b/src/test/correct/switch2/gcc/switch2.expected @@ -1,65 +1,65 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"}bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,7 +100,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,12 +109,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R29, R30, R31, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -210,41 +210,47 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #10: bv32; - var #11: bv32; - var #12: bv32; - var #4: bv64; - var #5: bv32; - var #6: bv32; - var #7: bv32; - var #8: bv32; - var #9: bv32; - var CF: bv1; - var Gamma_#10: bool; - var Gamma_#11: bool; - var Gamma_#12: bool; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_#7: bool; - var Gamma_#8: bool; - var Gamma_#9: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #10: bv32; + var #11: bv32; + var #12: bv32; + var #4: bv64; + var #5: bv32; + var #6: bv32; + var #7: bv32; + var #8: bv32; + var #9: bv32; + var CF: bv1; + var Gamma_#10: bool; + var Gamma_#11: bool; + var Gamma_#12: bool; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_#7: bool; + var Gamma_#8: bool; + var Gamma_#9: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x71c"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x71c"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x724"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); + assume {:captureState "addr:0x728"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), true); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#5); @@ -257,10 +263,13 @@ procedure main() } goto l00000408; l000003d0: + assume {:captureState "addr:0x7bc"}true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x7c0"}true; goto l000003e2; l00000408: + assume {:captureState "addr:0x73c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#6); @@ -273,6 +282,7 @@ procedure main() } goto l00000430; l00000430: + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #7, Gamma_#7 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#7); @@ -285,6 +295,7 @@ procedure main() } goto l00000467; l00000467: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #8, Gamma_#8 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#8); @@ -297,6 +308,7 @@ procedure main() } goto l0000048f; l0000048f: + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #9, Gamma_#9 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#9); @@ -309,13 +321,17 @@ procedure main() } goto l000004e2; l000004b0: + assume {:captureState "addr:0x794"}true; R30, Gamma_R30 := 1944bv64, true; call r(); goto l000004bc; l000004bc: + assume {:captureState "addr:0x798"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x798"}true; goto l000004c4; l000004e2: + assume {:captureState "addr:0x76c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #10, Gamma_#10 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#10); @@ -328,6 +344,7 @@ procedure main() } goto l0000050a; l0000050a: + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #11, Gamma_#11 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#11); @@ -340,10 +357,13 @@ procedure main() } goto l00000530; l000004c4: + assume {:captureState "addr:0x79c"}true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x7a0"}true; goto l000003f1; l00000530: + assume {:captureState "addr:0x784"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #12, Gamma_#12 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#12); @@ -356,27 +376,35 @@ procedure main() } goto l00000556; l000004d5: + assume {:captureState "addr:0x7a8"}true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x7ac"}true; goto l00000451; l00000451: + assume {:captureState "addr:0x7b0"}true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x7b4"}true; goto l000003f1; l00000556: + assume {:captureState "addr:0x790"}true; goto l000003e2; l000003e2: + assume {:captureState "addr:0x7c4"}true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x7c8"}true; goto l000003f1; l000003f1: + assume {:captureState "addr:0x7d0"}true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 48bv64), Gamma_R31; return; } -procedure r() +procedure r() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 2032bv64) == 1bv8); free requires (memory_load8_le(mem, 2033bv64) == 0bv8); @@ -452,6 +480,7 @@ procedure r() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lr: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 1bv64, true; return; } diff --git a/src/test/correct/switch2/gcc_O2/switch2.expected b/src/test/correct/switch2/gcc_O2/switch2.expected index 0981e4f48..40a765b0b 100644 --- a/src/test/correct/switch2/gcc_O2/switch2.expected +++ b/src/test/correct/switch2/gcc_O2/switch2.expected @@ -1,11 +1,11 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } mem: [bv64]bv8; -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }mem: [bv64]bv8; +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -46,7 +46,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -55,12 +55,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -152,5 +152,6 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; return; } diff --git a/src/test/correct/switch2/gcc_no_plt_no_pic/switch2.expected b/src/test/correct/switch2/gcc_no_plt_no_pic/switch2.expected index 3ec629a95..3128f788a 100644 --- a/src/test/correct/switch2/gcc_no_plt_no_pic/switch2.expected +++ b/src/test/correct/switch2/gcc_no_plt_no_pic/switch2.expected @@ -1,65 +1,65 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"}bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,7 +100,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,12 +109,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R29, R30, R31, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -210,41 +210,47 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #10: bv32; - var #11: bv32; - var #12: bv32; - var #4: bv64; - var #5: bv32; - var #6: bv32; - var #7: bv32; - var #8: bv32; - var #9: bv32; - var CF: bv1; - var Gamma_#10: bool; - var Gamma_#11: bool; - var Gamma_#12: bool; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_#7: bool; - var Gamma_#8: bool; - var Gamma_#9: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #10: bv32; + var #11: bv32; + var #12: bv32; + var #4: bv64; + var #5: bv32; + var #6: bv32; + var #7: bv32; + var #8: bv32; + var #9: bv32; + var CF: bv1; + var Gamma_#10: bool; + var Gamma_#11: bool; + var Gamma_#12: bool; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_#7: bool; + var Gamma_#8: bool; + var Gamma_#9: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x71c"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x71c"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x724"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); + assume {:captureState "addr:0x728"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), true); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#5); @@ -257,10 +263,13 @@ procedure main() } goto l00000c67; l00000c2f: + assume {:captureState "addr:0x7bc"}true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x7c0"}true; goto l00000c41; l00000c67: + assume {:captureState "addr:0x73c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#6); @@ -273,6 +282,7 @@ procedure main() } goto l00000c8f; l00000c8f: + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #7, Gamma_#7 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#7); @@ -285,6 +295,7 @@ procedure main() } goto l00000cc6; l00000cc6: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #8, Gamma_#8 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#8); @@ -297,6 +308,7 @@ procedure main() } goto l00000cee; l00000cee: + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #9, Gamma_#9 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#9); @@ -309,13 +321,17 @@ procedure main() } goto l00000d41; l00000d0f: + assume {:captureState "addr:0x794"}true; R30, Gamma_R30 := 1944bv64, true; call r(); goto l00000d1b; l00000d1b: + assume {:captureState "addr:0x798"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x798"}true; goto l00000d23; l00000d41: + assume {:captureState "addr:0x76c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #10, Gamma_#10 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#10); @@ -328,6 +344,7 @@ procedure main() } goto l00000d69; l00000d69: + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #11, Gamma_#11 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#11); @@ -340,10 +357,13 @@ procedure main() } goto l00000d8f; l00000d23: + assume {:captureState "addr:0x79c"}true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x7a0"}true; goto l00000c50; l00000d8f: + assume {:captureState "addr:0x784"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #12, Gamma_#12 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#12); @@ -356,27 +376,35 @@ procedure main() } goto l00000db5; l00000d34: + assume {:captureState "addr:0x7a8"}true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x7ac"}true; goto l00000cb0; l00000cb0: + assume {:captureState "addr:0x7b0"}true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x7b4"}true; goto l00000c50; l00000db5: + assume {:captureState "addr:0x790"}true; goto l00000c41; l00000c41: + assume {:captureState "addr:0x7c4"}true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x7c8"}true; goto l00000c50; l00000c50: + assume {:captureState "addr:0x7d0"}true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 48bv64), Gamma_R31; return; } -procedure r() +procedure r() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 2032bv64) == 1bv8); free requires (memory_load8_le(mem, 2033bv64) == 0bv8); @@ -452,6 +480,7 @@ procedure r() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lr: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 1bv64, true; return; } diff --git a/src/test/correct/switch2/gcc_pic/switch2.expected b/src/test/correct/switch2/gcc_pic/switch2.expected index 3ec629a95..3128f788a 100644 --- a/src/test/correct/switch2/gcc_pic/switch2.expected +++ b/src/test/correct/switch2/gcc_pic/switch2.expected @@ -1,65 +1,65 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"}bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,7 +100,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,12 +109,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R29, R30, R31, stack; requires (Gamma_R0 == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -210,41 +210,47 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #10: bv32; - var #11: bv32; - var #12: bv32; - var #4: bv64; - var #5: bv32; - var #6: bv32; - var #7: bv32; - var #8: bv32; - var #9: bv32; - var CF: bv1; - var Gamma_#10: bool; - var Gamma_#11: bool; - var Gamma_#12: bool; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_#7: bool; - var Gamma_#8: bool; - var Gamma_#9: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #10: bv32; + var #11: bv32; + var #12: bv32; + var #4: bv64; + var #5: bv32; + var #6: bv32; + var #7: bv32; + var #8: bv32; + var #9: bv32; + var CF: bv1; + var Gamma_#10: bool; + var Gamma_#11: bool; + var Gamma_#12: bool; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_#7: bool; + var Gamma_#8: bool; + var Gamma_#9: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x71c"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x71c"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x71c"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x724"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); + assume {:captureState "addr:0x728"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), true); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#5); @@ -257,10 +263,13 @@ procedure main() } goto l00000c67; l00000c2f: + assume {:captureState "addr:0x7bc"}true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x7c0"}true; goto l00000c41; l00000c67: + assume {:captureState "addr:0x73c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#6); @@ -273,6 +282,7 @@ procedure main() } goto l00000c8f; l00000c8f: + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #7, Gamma_#7 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#7); @@ -285,6 +295,7 @@ procedure main() } goto l00000cc6; l00000cc6: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #8, Gamma_#8 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#8); @@ -297,6 +308,7 @@ procedure main() } goto l00000cee; l00000cee: + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #9, Gamma_#9 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#9); @@ -309,13 +321,17 @@ procedure main() } goto l00000d41; l00000d0f: + assume {:captureState "addr:0x794"}true; R30, Gamma_R30 := 1944bv64, true; call r(); goto l00000d1b; l00000d1b: + assume {:captureState "addr:0x798"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x798"}true; goto l00000d23; l00000d41: + assume {:captureState "addr:0x76c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #10, Gamma_#10 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#10); @@ -328,6 +344,7 @@ procedure main() } goto l00000d69; l00000d69: + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #11, Gamma_#11 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#11); @@ -340,10 +357,13 @@ procedure main() } goto l00000d8f; l00000d23: + assume {:captureState "addr:0x79c"}true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x7a0"}true; goto l00000c50; l00000d8f: + assume {:captureState "addr:0x784"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #12, Gamma_#12 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#12); @@ -356,27 +376,35 @@ procedure main() } goto l00000db5; l00000d34: + assume {:captureState "addr:0x7a8"}true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x7ac"}true; goto l00000cb0; l00000cb0: + assume {:captureState "addr:0x7b0"}true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x7b4"}true; goto l00000c50; l00000db5: + assume {:captureState "addr:0x790"}true; goto l00000c41; l00000c41: + assume {:captureState "addr:0x7c4"}true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x7c8"}true; goto l00000c50; l00000c50: + assume {:captureState "addr:0x7d0"}true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 48bv64), Gamma_R31; return; } -procedure r() +procedure r() modifies Gamma_R0, R0; free requires (memory_load8_le(mem, 2032bv64) == 1bv8); free requires (memory_load8_le(mem, 2033bv64) == 0bv8); @@ -452,6 +480,7 @@ procedure r() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lr: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 1bv64, true; return; } diff --git a/src/test/correct/syscall/clang/syscall.expected b/src/test/correct/syscall/clang/syscall.expected index 963b64a1b..16febb0c3 100644 --- a/src/test/correct/syscall/clang/syscall.expected +++ b/src/test/correct/syscall/clang/syscall.expected @@ -1,62 +1,62 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1944bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1944bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,12 +106,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure fork(); +procedure fork(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1944bv64) == 1bv8); free requires (memory_load8_le(mem, 1945bv64) == 0bv8); @@ -186,7 +186,7 @@ procedure fork(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -281,24 +281,32 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x758"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x758"}true; R29, Gamma_R29 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); + assume {:captureState "addr:0x760"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551608bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551608bv64), Gamma_R0); + assume {:captureState "addr:0x764"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); + assume {:captureState "addr:0x768"}true; R30, Gamma_R30 := 1904bv64, true; call fork(); goto l00000317; l00000317: + assume {:captureState "addr:0x770"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x770"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/syscall/clang_no_plt_no_pic/syscall.expected b/src/test/correct/syscall/clang_no_plt_no_pic/syscall.expected index b16b7a269..d6e7b2e96 100644 --- a/src/test/correct/syscall/clang_no_plt_no_pic/syscall.expected +++ b/src/test/correct/syscall/clang_no_plt_no_pic/syscall.expected @@ -1,62 +1,62 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1944bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1944bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,12 +106,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure fork(); +procedure fork(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1944bv64) == 1bv8); free requires (memory_load8_le(mem, 1945bv64) == 0bv8); @@ -186,7 +186,7 @@ procedure fork(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -281,24 +281,32 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x758"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x758"}true; R29, Gamma_R29 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); + assume {:captureState "addr:0x760"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551608bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551608bv64), Gamma_R0); + assume {:captureState "addr:0x764"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); + assume {:captureState "addr:0x768"}true; R30, Gamma_R30 := 1904bv64, true; call fork(); goto l0000092f; l0000092f: + assume {:captureState "addr:0x770"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x770"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/syscall/clang_pic/syscall.expected b/src/test/correct/syscall/clang_pic/syscall.expected index b16b7a269..d6e7b2e96 100644 --- a/src/test/correct/syscall/clang_pic/syscall.expected +++ b/src/test/correct/syscall/clang_pic/syscall.expected @@ -1,62 +1,62 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1944bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1944bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,12 +106,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure fork(); +procedure fork(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1944bv64) == 1bv8); free requires (memory_load8_le(mem, 1945bv64) == 0bv8); @@ -186,7 +186,7 @@ procedure fork(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69672bv64) == 0bv8); free requires (memory_load8_le(mem, 69673bv64) == 0bv8); @@ -281,24 +281,32 @@ procedure main() free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { - var #4: bv64; - var #5: bv64; - var Gamma_#4: bool; - var Gamma_#5: bool; + var #4: bv64; + var #5: bv64; + var Gamma_#4: bool; + var Gamma_#5: bool; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x758"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x758"}true; R29, Gamma_R29 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); + assume {:captureState "addr:0x760"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551608bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551608bv64), Gamma_R0); + assume {:captureState "addr:0x764"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); + assume {:captureState "addr:0x768"}true; R30, Gamma_R30 := 1904bv64, true; call fork(); goto l0000092f; l0000092f: + assume {:captureState "addr:0x770"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x770"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/syscall/gcc/syscall.expected b/src/test/correct/syscall/gcc/syscall.expected index 28bfcaccb..c22fb9300 100644 --- a/src/test/correct/syscall/gcc/syscall.expected +++ b/src/test/correct/syscall/gcc/syscall.expected @@ -1,62 +1,62 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1932bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1932bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,12 +106,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure fork(); +procedure fork(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1932bv64) == 1bv8); free requires (memory_load8_le(mem, 1933bv64) == 0bv8); @@ -186,7 +186,7 @@ procedure fork(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -281,21 +281,28 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x754"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x754"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x75c"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); + assume {:captureState "addr:0x760"}true; R30, Gamma_R30 := 1896bv64, true; call fork(); goto l00000302; l00000302: + assume {:captureState "addr:0x768"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 44bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 44bv64)); R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/syscall/gcc_O2/syscall.expected b/src/test/correct/syscall/gcc_O2/syscall.expected index 3721f3ecb..29ff7f2b3 100644 --- a/src/test/correct/syscall/gcc_O2/syscall.expected +++ b/src/test/correct/syscall/gcc_O2/syscall.expected @@ -1,16 +1,16 @@ -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1960bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1960bv64); +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -51,7 +51,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -60,12 +60,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure fork(); +procedure fork(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); diff --git a/src/test/correct/syscall/gcc_no_plt_no_pic/syscall.expected b/src/test/correct/syscall/gcc_no_plt_no_pic/syscall.expected index 4d053ce92..605df38e0 100644 --- a/src/test/correct/syscall/gcc_no_plt_no_pic/syscall.expected +++ b/src/test/correct/syscall/gcc_no_plt_no_pic/syscall.expected @@ -1,62 +1,62 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1932bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1932bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,12 +106,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure fork(); +procedure fork(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1932bv64) == 1bv8); free requires (memory_load8_le(mem, 1933bv64) == 0bv8); @@ -186,7 +186,7 @@ procedure fork(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -281,21 +281,28 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x754"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x754"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x75c"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); + assume {:captureState "addr:0x760"}true; R30, Gamma_R30 := 1896bv64, true; call fork(); goto l000008f9; l000008f9: + assume {:captureState "addr:0x768"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 44bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 44bv64)); R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/syscall/gcc_pic/syscall.expected b/src/test/correct/syscall/gcc_pic/syscall.expected index 4d053ce92..605df38e0 100644 --- a/src/test/correct/syscall/gcc_pic/syscall.expected +++ b/src/test/correct/syscall/gcc_pic/syscall.expected @@ -1,62 +1,62 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; -axiom {:extern } ($_IO_stdin_used_addr == 1932bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R16: bool; +var {:extern }Gamma_R17: bool; +var {:extern }Gamma_R29: bool; +var {:extern }Gamma_R30: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R16: bv64; +var {:extern }R17: bv64; +var {:extern }R29: bv64; +var {:extern }R30: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$_IO_stdin_used_addr: bv64; +axiom {:extern }($_IO_stdin_used_addr == 1932bv64); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,12 +106,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure fork(); +procedure fork(); modifies Gamma_R16, Gamma_R17, R16, R17; free requires (memory_load8_le(mem, 1932bv64) == 1bv8); free requires (memory_load8_le(mem, 1933bv64) == 0bv8); @@ -186,7 +186,7 @@ procedure fork(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure main() +procedure main() modifies Gamma_R0, Gamma_R16, Gamma_R17, Gamma_R29, Gamma_R30, Gamma_R31, Gamma_stack, R0, R16, R17, R29, R30, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -281,21 +281,28 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv64; - var Gamma_#4: bool; + var #4: bv64; + var Gamma_#4: bool; lmain: + assume {:captureState "addr:0x754"}true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); + assume {:captureState "addr:0x754"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x75c"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); + assume {:captureState "addr:0x760"}true; R30, Gamma_R30 := 1896bv64, true; call fork(); goto l000008f9; l000008f9: + assume {:captureState "addr:0x768"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 44bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 44bv64)); R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/using_gamma_conditional/clang/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/clang/using_gamma_conditional.expected index 22fdbb950..19b31d637 100644 --- a/src/test/correct/using_gamma_conditional/clang/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/clang/using_gamma_conditional.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -95,18 +95,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -200,19 +200,21 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -240,15 +242,21 @@ procedure main() } goto l00000358; l00000330: + assume {:captureState "addr:0x73c"}true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x740"}true; goto l00000343; l00000358: + assume {:captureState "addr:0x730"}true; goto l00000359; l00000359: + assume {:captureState "addr:0x734"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x734"}true; goto l00000343; l00000343: + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/using_gamma_conditional/clang_O2/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/clang_O2/using_gamma_conditional.expected index 168de6b0c..d44f99374 100644 --- a/src/test/correct/using_gamma_conditional/clang_O2/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/clang_O2/using_gamma_conditional.expected @@ -1,40 +1,40 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -75,7 +75,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -83,18 +83,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_mem, R0, R8, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -186,17 +186,18 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); diff --git a/src/test/correct/using_gamma_conditional/clang_no_plt_no_pic/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/clang_no_plt_no_pic/using_gamma_conditional.expected index c29922767..eb2bb7d65 100644 --- a/src/test/correct/using_gamma_conditional/clang_no_plt_no_pic/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/clang_no_plt_no_pic/using_gamma_conditional.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -95,18 +95,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -200,19 +200,21 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -240,15 +242,21 @@ procedure main() } goto l00000973; l0000094b: + assume {:captureState "addr:0x73c"}true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x740"}true; goto l0000095e; l00000973: + assume {:captureState "addr:0x730"}true; goto l00000974; l00000974: + assume {:captureState "addr:0x734"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x734"}true; goto l0000095e; l0000095e: + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/using_gamma_conditional/clang_pic/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/clang_pic/using_gamma_conditional.expected index 95fd3d718..3055085a8 100644 --- a/src/test/correct/using_gamma_conditional/clang_pic/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/clang_pic/using_gamma_conditional.expected @@ -1,60 +1,60 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69684bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -103,7 +103,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -111,18 +111,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_mem, Gamma_stack, R0, R31, R8, mem, stack; requires (gamma_load32(Gamma_mem, $x_addr) == true); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -232,19 +232,21 @@ procedure main() free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x758"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4040bv64)) || L(mem, bvadd64(R8, 4040bv64))); @@ -274,15 +276,21 @@ procedure main() } goto l00000363; l0000033b: + assume {:captureState "addr:0x780"}true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x784"}true; goto l0000034e; l00000363: + assume {:captureState "addr:0x774"}true; goto l00000364; l00000364: + assume {:captureState "addr:0x778"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x778"}true; goto l0000034e; l0000034e: + assume {:captureState "addr:0x78c"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/using_gamma_conditional/gcc/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/gcc/using_gamma_conditional.expected index 12163b705..91c5174a3 100644 --- a/src/test/correct/using_gamma_conditional/gcc/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/gcc/using_gamma_conditional.expected @@ -1,38 +1,38 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -73,7 +73,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -81,18 +81,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_mem, R0, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -184,17 +184,18 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -210,11 +211,14 @@ procedure main() } goto l00000309; l000002fa: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 1bv64, true; goto l00000304; l00000309: + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 0bv64, true; goto l00000304; l00000304: + assume {:captureState "addr:0x734"}true; return; } diff --git a/src/test/correct/using_gamma_conditional/gcc_O2/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/gcc_O2/using_gamma_conditional.expected index 01a4117f8..91d0231c6 100644 --- a/src/test/correct/using_gamma_conditional/gcc_O2/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/gcc_O2/using_gamma_conditional.expected @@ -1,38 +1,38 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -73,7 +73,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -81,18 +81,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_mem, R0, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -184,17 +184,18 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv32; - var CF: bv1; - var Gamma_#1: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #1: bv32; + var CF: bv1; + var Gamma_#1: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x600"}true; R0, Gamma_R0 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R0, 20bv64))), (gamma_load32(Gamma_mem, bvadd64(R0, 20bv64)) || L(mem, bvadd64(R0, 20bv64))); diff --git a/src/test/correct/using_gamma_conditional/gcc_no_plt_no_pic/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/gcc_no_plt_no_pic/using_gamma_conditional.expected index c9fd53c65..1d618a77c 100644 --- a/src/test/correct/using_gamma_conditional/gcc_no_plt_no_pic/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/gcc_no_plt_no_pic/using_gamma_conditional.expected @@ -1,38 +1,38 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -73,7 +73,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -81,18 +81,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_mem, R0, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -184,17 +184,18 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -210,11 +211,14 @@ procedure main() } goto l000008c2; l000008b3: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 1bv64, true; goto l000008bd; l000008c2: + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 0bv64, true; goto l000008bd; l000008bd: + assume {:captureState "addr:0x734"}true; return; } diff --git a/src/test/correct/using_gamma_conditional/gcc_pic/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/gcc_pic/using_gamma_conditional.expected index c2f2a74f1..55866c8b9 100644 --- a/src/test/correct/using_gamma_conditional/gcc_pic/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/gcc_pic/using_gamma_conditional.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -89,7 +89,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -97,18 +97,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_mem, R0, mem; requires (gamma_load32(Gamma_mem, $x_addr) == true); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -216,17 +216,18 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -243,11 +244,14 @@ procedure main() } goto l0000030a; l000002fb: + assume {:captureState "addr:0x770"}true; R0, Gamma_R0 := 1bv64, true; goto l00000305; l0000030a: + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := 0bv64, true; goto l00000305; l00000305: + assume {:captureState "addr:0x774"}true; return; } diff --git a/src/test/correct/using_gamma_write_z/clang/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/clang/using_gamma_write_z.expected index 773db35a9..5257e2483 100644 --- a/src/test/correct/using_gamma_write_z/clang/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/clang/using_gamma_write_z.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -84,18 +84,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires ((memory_load32_le(mem, $z_addr) == 0bv32) ==> gamma_load32(Gamma_mem, $x_addr)); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -187,8 +187,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; + var Gamma_x_old: bool; lmain: + assume {:captureState "addr:0x714"}true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -197,6 +198,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert (Gamma_x_old ==> gamma_load32(Gamma_mem, $x_addr)); + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/using_gamma_write_z/clang_O2/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/clang_O2/using_gamma_write_z.expected index 053777c1a..1ad5400b4 100644 --- a/src/test/correct/using_gamma_write_z/clang_O2/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/clang_O2/using_gamma_write_z.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -84,18 +84,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires ((memory_load32_le(mem, $z_addr) == 0bv32) ==> gamma_load32(Gamma_mem, $x_addr)); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -187,8 +187,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; + var Gamma_x_old: bool; lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -198,5 +199,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); assert ((bvadd64(R8, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert (Gamma_x_old ==> gamma_load32(Gamma_mem, $x_addr)); + assume {:captureState "addr:0x720"}true; return; } diff --git a/src/test/correct/using_gamma_write_z/clang_no_plt_no_pic/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/clang_no_plt_no_pic/using_gamma_write_z.expected index 773db35a9..5257e2483 100644 --- a/src/test/correct/using_gamma_write_z/clang_no_plt_no_pic/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/clang_no_plt_no_pic/using_gamma_write_z.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -84,18 +84,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires ((memory_load32_le(mem, $z_addr) == 0bv32) ==> gamma_load32(Gamma_mem, $x_addr)); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -187,8 +187,9 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var Gamma_x_old: bool; + var Gamma_x_old: bool; lmain: + assume {:captureState "addr:0x714"}true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -197,6 +198,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert (Gamma_x_old ==> gamma_load32(Gamma_mem, $x_addr)); + assume {:captureState "addr:0x71c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/using_gamma_write_z/clang_pic/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/clang_pic/using_gamma_write_z.expected index fd247c995..9d4f0b023 100644 --- a/src/test/correct/using_gamma_write_z/clang_pic/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/clang_pic/using_gamma_write_z.expected @@ -1,49 +1,49 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69684bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -92,7 +92,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -100,18 +100,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; requires ((memory_load32_le(mem, $z_addr) == 0bv32) ==> gamma_load32(Gamma_mem, $x_addr)); free requires (memory_load8_le(mem, 69664bv64) == 0bv8); @@ -219,8 +219,9 @@ procedure main() free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { - var Gamma_x_old: bool; + var Gamma_x_old: bool; lmain: + assume {:captureState "addr:0x754"}true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); @@ -231,6 +232,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert ((R9 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert (Gamma_x_old ==> gamma_load32(Gamma_mem, $x_addr)); + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/using_gamma_write_z/gcc/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/gcc/using_gamma_write_z.expected index 992a9b6a2..faa535bd0 100644 --- a/src/test/correct/using_gamma_write_z/gcc/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/gcc/using_gamma_write_z.expected @@ -1,39 +1,39 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -74,7 +74,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -82,18 +82,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires ((memory_load32_le(mem, $z_addr) == 0bv32) ==> gamma_load32(Gamma_mem, $x_addr)); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -185,8 +185,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; + var Gamma_x_old: bool; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -196,6 +197,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert (Gamma_x_old ==> gamma_load32(Gamma_mem, $x_addr)); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/using_gamma_write_z/gcc_O2/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/gcc_O2/using_gamma_write_z.expected index ff75843be..137eb78e6 100644 --- a/src/test/correct/using_gamma_write_z/gcc_O2/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/gcc_O2/using_gamma_write_z.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69656bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69656bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -84,18 +84,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; requires ((memory_load32_le(mem, $z_addr) == 0bv32) ==> gamma_load32(Gamma_mem, $x_addr)); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -187,8 +187,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; + var Gamma_x_old: bool; lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 1bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -198,5 +199,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R2); assert ((bvadd64(R1, 20bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert (Gamma_x_old ==> gamma_load32(Gamma_mem, $x_addr)); + assume {:captureState "addr:0x60c"}true; return; } diff --git a/src/test/correct/using_gamma_write_z/gcc_no_plt_no_pic/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/gcc_no_plt_no_pic/using_gamma_write_z.expected index 992a9b6a2..faa535bd0 100644 --- a/src/test/correct/using_gamma_write_z/gcc_no_plt_no_pic/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/gcc_no_plt_no_pic/using_gamma_write_z.expected @@ -1,39 +1,39 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -74,7 +74,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -82,18 +82,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires ((memory_load32_le(mem, $z_addr) == 0bv32) ==> gamma_load32(Gamma_mem, $x_addr)); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -185,8 +185,9 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var Gamma_x_old: bool; + var Gamma_x_old: bool; lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -196,6 +197,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert (Gamma_x_old ==> gamma_load32(Gamma_mem, $x_addr)); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/using_gamma_write_z/gcc_pic/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/gcc_pic/using_gamma_write_z.expected index 01b4c71d9..15fdf23f4 100644 --- a/src/test/correct/using_gamma_write_z/gcc_pic/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/gcc_pic/using_gamma_write_z.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -90,7 +90,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -98,18 +98,18 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern }guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; requires ((memory_load32_le(mem, $z_addr) == 0bv32) ==> gamma_load32(Gamma_mem, $x_addr)); free requires (memory_load8_le(mem, 69632bv64) == 0bv8); @@ -217,8 +217,9 @@ procedure main() free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { - var Gamma_x_old: bool; + var Gamma_x_old: bool; lmain: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -229,6 +230,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert (Gamma_x_old ==> gamma_load32(Gamma_mem, $x_addr)); + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/incorrect/basicassign/clang/basicassign.expected b/src/test/incorrect/basicassign/clang/basicassign.expected index 1f0dc70e5..a768e33c0 100644 --- a/src/test/incorrect/basicassign/clang/basicassign.expected +++ b/src/test/incorrect/basicassign/clang/basicassign.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R11: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R11: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69684bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69692bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R11: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R11: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69684bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69692bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -91,15 +91,15 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R11, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R11, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -191,6 +191,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R10, Gamma_R10 := 69632bv64, true; call rely(); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(mem, bvadd64(R10, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R10, 52bv64)) || L(mem, bvadd64(R10, 52bv64))); @@ -198,25 +199,30 @@ procedure main() call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), Gamma_R9); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> true); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); + assume {:captureState "addr:0x728"}true; call rely(); R11, Gamma_R11 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 60bv64)) ==> Gamma_R11); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 60bv64), R11[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 60bv64), Gamma_R11); + assume {:captureState "addr:0x734"}true; call rely(); R10, Gamma_R10 := zero_extend32_32(memory_load32_le(mem, bvadd64(R10, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R10, 52bv64)) || L(mem, bvadd64(R10, 52bv64))); call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), Gamma_R10); + assume {:captureState "addr:0x73c"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); call rely(); assert (L(mem, bvadd64(R9, 60bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 60bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 60bv64), Gamma_R8); + assume {:captureState "addr:0x744"}true; return; } diff --git a/src/test/incorrect/basicassign/clang_O2/basicassign.expected b/src/test/incorrect/basicassign/clang_O2/basicassign.expected index 15f1e50a5..b9d00d50e 100644 --- a/src/test/incorrect/basicassign/clang_O2/basicassign.expected +++ b/src/test/incorrect/basicassign/clang_O2/basicassign.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69684bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69692bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69684bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69692bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -89,15 +89,15 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -189,6 +189,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; R9, Gamma_R9 := 69632bv64, true; @@ -198,8 +199,10 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); + assume {:captureState "addr:0x728"}true; call rely(); assert (L(mem, bvadd64(R10, 60bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R10, 60bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R10, 60bv64), Gamma_R8); + assume {:captureState "addr:0x72c"}true; return; } diff --git a/src/test/incorrect/basicassign/clang_no_plt_no_pic/basicassign.expected b/src/test/incorrect/basicassign/clang_no_plt_no_pic/basicassign.expected index 1f0dc70e5..a768e33c0 100644 --- a/src/test/incorrect/basicassign/clang_no_plt_no_pic/basicassign.expected +++ b/src/test/incorrect/basicassign/clang_no_plt_no_pic/basicassign.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R11: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R11: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69684bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69692bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R11: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R11: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69684bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69692bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -91,15 +91,15 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R11, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R11, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -191,6 +191,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R10, Gamma_R10 := 69632bv64, true; call rely(); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(mem, bvadd64(R10, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R10, 52bv64)) || L(mem, bvadd64(R10, 52bv64))); @@ -198,25 +199,30 @@ procedure main() call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), Gamma_R9); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> true); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); + assume {:captureState "addr:0x728"}true; call rely(); R11, Gamma_R11 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 60bv64)) ==> Gamma_R11); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 60bv64), R11[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 60bv64), Gamma_R11); + assume {:captureState "addr:0x734"}true; call rely(); R10, Gamma_R10 := zero_extend32_32(memory_load32_le(mem, bvadd64(R10, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R10, 52bv64)) || L(mem, bvadd64(R10, 52bv64))); call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), Gamma_R10); + assume {:captureState "addr:0x73c"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); call rely(); assert (L(mem, bvadd64(R9, 60bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 60bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 60bv64), Gamma_R8); + assume {:captureState "addr:0x744"}true; return; } diff --git a/src/test/incorrect/basicassign/clang_pic/basicassign.expected b/src/test/incorrect/basicassign/clang_pic/basicassign.expected index 9331c2d78..b64b8edc6 100644 --- a/src/test/incorrect/basicassign/clang_pic/basicassign.expected +++ b/src/test/incorrect/basicassign/clang_pic/basicassign.expected @@ -1,56 +1,56 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R11: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R11: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69684bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69692bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R11: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R11: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69684bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69692bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -115,7 +115,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69566bv64) == 0bv8); free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -123,15 +123,15 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R11, Gamma_R8, Gamma_R9, Gamma_mem, R0, R10, R11, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -271,6 +271,7 @@ procedure main() free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x754"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -282,10 +283,12 @@ procedure main() call rely(); assert (L(mem, R8) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, R8, R9[32:0]), gamma_store32(Gamma_mem, R8, Gamma_R9); + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, R8) ==> true); mem, Gamma_mem := memory_store32_le(mem, R8, 0bv32), gamma_store32(Gamma_mem, R8, true); + assume {:captureState "addr:0x770"}true; call rely(); R11, Gamma_R11 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); R9, Gamma_R9 := 65536bv64, true; @@ -294,15 +297,18 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R11); mem, Gamma_mem := memory_store32_le(mem, R9, R11[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R11); + assume {:captureState "addr:0x780"}true; call rely(); R10, Gamma_R10 := zero_extend32_32(memory_load32_le(mem, R10)), (gamma_load32(Gamma_mem, R10) || L(mem, R10)); call rely(); assert (L(mem, R8) ==> Gamma_R10); mem, Gamma_mem := memory_store32_le(mem, R8, R10[32:0]), gamma_store32(Gamma_mem, R8, Gamma_R10); + assume {:captureState "addr:0x788"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x790"}true; return; } diff --git a/src/test/incorrect/basicassign/gcc/basicassign.expected b/src/test/incorrect/basicassign/gcc/basicassign.expected index 0c1790ecb..d3c439a15 100644 --- a/src/test/incorrect/basicassign/gcc/basicassign.expected +++ b/src/test/incorrect/basicassign/gcc/basicassign.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69660bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69660bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -85,15 +85,15 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -185,6 +185,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 28bv64), Gamma_R0; call rely(); @@ -194,11 +195,13 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); assert (L(mem, R0) ==> true); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); + assume {:captureState "addr:0x734"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -208,6 +211,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 28bv64), Gamma_R0; call rely(); @@ -217,6 +221,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x764"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -226,6 +231,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x77c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/incorrect/basicassign/gcc_O2/basicassign.expected b/src/test/incorrect/basicassign/gcc_O2/basicassign.expected index b2f1dce40..ebd579c95 100644 --- a/src/test/incorrect/basicassign/gcc_O2/basicassign.expected +++ b/src/test/incorrect/basicassign/gcc_O2/basicassign.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69652bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69656bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69660bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69652bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69656bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69660bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -87,15 +87,15 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,9 +186,10 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #1: bv64; - var Gamma_#1: bool; + var #1: bv64; + var Gamma_#1: bool; lmain: + assume {:captureState "addr:0x600"}true; R2, Gamma_R2 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R2, 20bv64), Gamma_R2; R0, Gamma_R0 := 0bv64, true; @@ -198,8 +199,10 @@ procedure main() call rely(); assert (L(mem, #1) ==> Gamma_R2); mem, Gamma_mem := memory_store32_le(mem, #1, R2[32:0]), gamma_store32(Gamma_mem, #1, Gamma_R2); + assume {:captureState "addr:0x610"}true; call rely(); assert (L(mem, bvadd64(#1, 4bv64)) ==> Gamma_R2); mem, Gamma_mem := memory_store32_le(mem, bvadd64(#1, 4bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(#1, 4bv64), Gamma_R2); + assume {:captureState "addr:0x610"}true; return; } diff --git a/src/test/incorrect/basicassign/gcc_no_plt_no_pic/basicassign.expected b/src/test/incorrect/basicassign/gcc_no_plt_no_pic/basicassign.expected index 0c1790ecb..d3c439a15 100644 --- a/src/test/incorrect/basicassign/gcc_no_plt_no_pic/basicassign.expected +++ b/src/test/incorrect/basicassign/gcc_no_plt_no_pic/basicassign.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69660bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69660bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -85,15 +85,15 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -185,6 +185,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 28bv64), Gamma_R0; call rely(); @@ -194,11 +195,13 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); assert (L(mem, R0) ==> true); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); + assume {:captureState "addr:0x734"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -208,6 +211,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 28bv64), Gamma_R0; call rely(); @@ -217,6 +221,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x764"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -226,6 +231,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x77c"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/incorrect/basicassign/gcc_pic/basicassign.expected b/src/test/incorrect/basicassign/gcc_pic/basicassign.expected index 2dbb60da7..2c96223f8 100644 --- a/src/test/incorrect/basicassign/gcc_pic/basicassign.expected +++ b/src/test/incorrect/basicassign/gcc_pic/basicassign.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69660bv64); -const {:extern } $x_addr: bv64; -axiom {:extern } ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69660bv64); +const {:extern }$x_addr: bv64; +axiom {:extern }($x_addr == 69652bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -109,7 +109,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -117,15 +117,15 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern }rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_mem, R0, R1, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -265,6 +265,7 @@ procedure main() free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x754"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -276,12 +277,14 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); call rely(); assert (L(mem, R0) ==> true); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); + assume {:captureState "addr:0x774"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -293,6 +296,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x78c"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -304,6 +308,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x7a4"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -315,6 +320,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x7bc"}true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/incorrect/basicassign1/clang/basicassign1.expected b/src/test/incorrect/basicassign1/clang/basicassign1.expected index ec729c971..192f78118 100644 --- a/src/test/incorrect/basicassign1/clang/basicassign1.expected +++ b/src/test/incorrect/basicassign1/clang/basicassign1.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -189,25 +189,31 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 69632bv64, true; call rely(); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R9[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R9); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x728"}true; R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R10); + assume {:captureState "addr:0x734"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x73c"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); + assume {:captureState "addr:0x744"}true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/incorrect/basicassign1/clang_O2/basicassign1.expected b/src/test/incorrect/basicassign1/clang_O2/basicassign1.expected index 84abb6e54..e2752e088 100644 --- a/src/test/incorrect/basicassign1/clang_O2/basicassign1.expected +++ b/src/test/incorrect/basicassign1/clang_O2/basicassign1.expected @@ -1,40 +1,40 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,12 +84,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -181,6 +181,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -189,5 +190,6 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; return; } diff --git a/src/test/incorrect/basicassign1/clang_no_plt_no_pic/basicassign1.expected b/src/test/incorrect/basicassign1/clang_no_plt_no_pic/basicassign1.expected index ec729c971..192f78118 100644 --- a/src/test/incorrect/basicassign1/clang_no_plt_no_pic/basicassign1.expected +++ b/src/test/incorrect/basicassign1/clang_no_plt_no_pic/basicassign1.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,12 +90,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -189,25 +189,31 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 69632bv64, true; call rely(); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R9[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R9); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x728"}true; R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R10); + assume {:captureState "addr:0x734"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x73c"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); + assume {:captureState "addr:0x744"}true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/incorrect/basicassign1/clang_pic/basicassign1.expected b/src/test/incorrect/basicassign1/clang_pic/basicassign1.expected index 38e80443e..aa368fb5d 100644 --- a/src/test/incorrect/basicassign1/clang_pic/basicassign1.expected +++ b/src/test/incorrect/basicassign1/clang_pic/basicassign1.expected @@ -1,54 +1,54 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -105,7 +105,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -114,12 +114,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -245,6 +245,7 @@ procedure main() free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 65536bv64, true; call rely(); @@ -252,8 +253,10 @@ procedure main() call rely(); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R9[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R9); + assume {:captureState "addr:0x764"}true; R0, Gamma_R0 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x76c"}true; R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := 65536bv64, true; call rely(); @@ -261,13 +264,16 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R10); mem, Gamma_mem := memory_store32_le(mem, R9, R10[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R10); + assume {:captureState "addr:0x77c"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); + assume {:captureState "addr:0x784"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x78c"}true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/incorrect/basicassign1/gcc/basicassign1.expected b/src/test/incorrect/basicassign1/gcc/basicassign1.expected index ce0525035..a51ad8781 100644 --- a/src/test/incorrect/basicassign1/gcc/basicassign1.expected +++ b/src/test/incorrect/basicassign1/gcc/basicassign1.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,12 +86,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -185,30 +185,36 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x724"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x758"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign1/gcc_O2/basicassign1.expected b/src/test/incorrect/basicassign1/gcc_O2/basicassign1.expected index 9f34a299e..6b430f3a3 100644 --- a/src/test/incorrect/basicassign1/gcc_O2/basicassign1.expected +++ b/src/test/incorrect/basicassign1/gcc_O2/basicassign1.expected @@ -1,40 +1,40 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,12 +84,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -181,6 +181,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; @@ -189,5 +190,6 @@ procedure main() call rely(); assert (L(mem, bvadd64(R1, 20bv64)) ==> Gamma_R2); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R2); + assume {:captureState "addr:0x610"}true; return; } diff --git a/src/test/incorrect/basicassign1/gcc_no_plt_no_pic/basicassign1.expected b/src/test/incorrect/basicassign1/gcc_no_plt_no_pic/basicassign1.expected index ce0525035..a51ad8781 100644 --- a/src/test/incorrect/basicassign1/gcc_no_plt_no_pic/basicassign1.expected +++ b/src/test/incorrect/basicassign1/gcc_no_plt_no_pic/basicassign1.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,12 +86,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -185,30 +185,36 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x724"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x758"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign1/gcc_pic/basicassign1.expected b/src/test/incorrect/basicassign1/gcc_pic/basicassign1.expected index 931d5b735..a2a6827aa 100644 --- a/src/test/incorrect/basicassign1/gcc_pic/basicassign1.expected +++ b/src/test/incorrect/basicassign1/gcc_pic/basicassign1.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69652bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,7 +101,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -110,12 +110,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -241,6 +241,7 @@ procedure main() free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -248,7 +249,9 @@ procedure main() call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x764"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -256,12 +259,14 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x788"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -269,6 +274,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x798"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign2/clang/basicassign2.expected b/src/test/incorrect/basicassign2/clang/basicassign2.expected index ed6b08561..d35372932 100644 --- a/src/test/incorrect/basicassign2/clang/basicassign2.expected +++ b/src/test/incorrect/basicassign2/clang/basicassign2.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69696bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69696bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,7 +82,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,12 +91,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -190,24 +190,30 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 69632bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R8, 56bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R9), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R9); + assume {:captureState "addr:0x720"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), 0bv64), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), true); + assume {:captureState "addr:0x724"}true; R10, Gamma_R10 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 64bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R9, 64bv64), R10), gamma_store64(Gamma_mem, bvadd64(R9, 64bv64), Gamma_R10); + assume {:captureState "addr:0x730"}true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 56bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x738"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); assert (L(mem, bvadd64(R9, 64bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R9, 64bv64), R8), gamma_store64(Gamma_mem, bvadd64(R9, 64bv64), Gamma_R8); + assume {:captureState "addr:0x740"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign2/clang_O2/basicassign2.expected b/src/test/incorrect/basicassign2/clang_O2/basicassign2.expected index c7390d655..3e8fe6723 100644 --- a/src/test/incorrect/basicassign2/clang_O2/basicassign2.expected +++ b/src/test/incorrect/basicassign2/clang_O2/basicassign2.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69696bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69696bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,12 +85,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -182,6 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -190,5 +191,6 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 64bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R9, 64bv64), R8), gamma_store64(Gamma_mem, bvadd64(R9, 64bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; return; } diff --git a/src/test/incorrect/basicassign2/clang_no_plt_no_pic/basicassign2.expected b/src/test/incorrect/basicassign2/clang_no_plt_no_pic/basicassign2.expected index ed6b08561..d35372932 100644 --- a/src/test/incorrect/basicassign2/clang_no_plt_no_pic/basicassign2.expected +++ b/src/test/incorrect/basicassign2/clang_no_plt_no_pic/basicassign2.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69696bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69696bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,7 +82,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,12 +91,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -190,24 +190,30 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 69632bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R8, 56bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R9), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R9); + assume {:captureState "addr:0x720"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), 0bv64), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), true); + assume {:captureState "addr:0x724"}true; R10, Gamma_R10 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 64bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R9, 64bv64), R10), gamma_store64(Gamma_mem, bvadd64(R9, 64bv64), Gamma_R10); + assume {:captureState "addr:0x730"}true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 56bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x738"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); assert (L(mem, bvadd64(R9, 64bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R9, 64bv64), R8), gamma_store64(Gamma_mem, bvadd64(R9, 64bv64), Gamma_R8); + assume {:captureState "addr:0x740"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign2/clang_pic/basicassign2.expected b/src/test/incorrect/basicassign2/clang_pic/basicassign2.expected index 572785ea3..308c39d3a 100644 --- a/src/test/incorrect/basicassign2/clang_pic/basicassign2.expected +++ b/src/test/incorrect/basicassign2/clang_pic/basicassign2.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69688bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69696bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69688bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69696bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,7 +98,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -107,12 +107,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -238,6 +238,7 @@ procedure main() free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 65536bv64, true; call rely(); @@ -245,7 +246,9 @@ procedure main() call rely(); R9, Gamma_R9 := memory_load64_le(mem, R8), (gamma_load64(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R9), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R9); + assume {:captureState "addr:0x764"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), 0bv64), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), true); + assume {:captureState "addr:0x768"}true; R10, Gamma_R10 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R9, Gamma_R9 := 65536bv64, true; call rely(); @@ -253,13 +256,16 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R10); mem, Gamma_mem := memory_store64_le(mem, R9, R10), gamma_store64(Gamma_mem, R9, Gamma_R10); + assume {:captureState "addr:0x778"}true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, R8), (gamma_load64(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x780"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store64_le(mem, R9, R8), gamma_store64(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x788"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign2/gcc/basicassign2.expected b/src/test/incorrect/basicassign2/gcc/basicassign2.expected index d6ab9abe6..296e49fcd 100644 --- a/src/test/incorrect/basicassign2/gcc/basicassign2.expected +++ b/src/test/incorrect/basicassign2/gcc/basicassign2.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69664bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69664bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -78,7 +78,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,12 +87,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,30 +186,36 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 32bv64), Gamma_R0; call rely(); R0, Gamma_R0 := memory_load64_le(mem, R0), (gamma_load64(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x724"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), 0bv64), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), true); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store64_le(mem, R0, R1), gamma_store64(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 32bv64), Gamma_R0; call rely(); R0, Gamma_R0 := memory_load64_le(mem, R0), (gamma_load64(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store64_le(mem, R0, R1), gamma_store64(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x758"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign2/gcc_O2/basicassign2.expected b/src/test/incorrect/basicassign2/gcc_O2/basicassign2.expected index 8cf4c92da..b4a8ceb51 100644 --- a/src/test/incorrect/basicassign2/gcc_O2/basicassign2.expected +++ b/src/test/incorrect/basicassign2/gcc_O2/basicassign2.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69664bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69664bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,12 +85,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -182,6 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 24bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; @@ -190,5 +191,6 @@ procedure main() call rely(); assert (L(mem, bvadd64(R1, 24bv64)) ==> Gamma_R2); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R1, 24bv64), R2), gamma_store64(Gamma_mem, bvadd64(R1, 24bv64), Gamma_R2); + assume {:captureState "addr:0x610"}true; return; } diff --git a/src/test/incorrect/basicassign2/gcc_no_plt_no_pic/basicassign2.expected b/src/test/incorrect/basicassign2/gcc_no_plt_no_pic/basicassign2.expected index d6ab9abe6..296e49fcd 100644 --- a/src/test/incorrect/basicassign2/gcc_no_plt_no_pic/basicassign2.expected +++ b/src/test/incorrect/basicassign2/gcc_no_plt_no_pic/basicassign2.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69664bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69664bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -78,7 +78,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,12 +87,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -186,30 +186,36 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 32bv64), Gamma_R0; call rely(); R0, Gamma_R0 := memory_load64_le(mem, R0), (gamma_load64(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x724"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), 0bv64), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), true); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store64_le(mem, R0, R1), gamma_store64(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 32bv64), Gamma_R0; call rely(); R0, Gamma_R0 := memory_load64_le(mem, R0), (gamma_load64(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store64_le(mem, R0, R1), gamma_store64(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x758"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign2/gcc_pic/basicassign2.expected b/src/test/incorrect/basicassign2/gcc_pic/basicassign2.expected index f8a96bad0..ad2d4daf3 100644 --- a/src/test/incorrect/basicassign2/gcc_pic/basicassign2.expected +++ b/src/test/incorrect/basicassign2/gcc_pic/basicassign2.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69664bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69664bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69656bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,12 +103,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -234,6 +234,7 @@ procedure main() free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -241,7 +242,9 @@ procedure main() call rely(); R0, Gamma_R0 := memory_load64_le(mem, R0), (gamma_load64(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x764"}true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), 0bv64), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), true); + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -249,12 +252,14 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store64_le(mem, R0, R1), gamma_store64(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); call rely(); R0, Gamma_R0 := memory_load64_le(mem, R0), (gamma_load64(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x788"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -262,6 +267,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store64_le(mem, R0, R1), gamma_store64(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x798"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign3/clang/basicassign3.expected b/src/test/incorrect/basicassign3/clang/basicassign3.expected index 55e019ce2..1f09e5048 100644 --- a/src/test/incorrect/basicassign3/clang/basicassign3.expected +++ b/src/test/incorrect/basicassign3/clang/basicassign3.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69681bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69682bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69681bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69682bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -187,24 +187,30 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 69632bv64, true; call rely(); R9, Gamma_R9 := zero_extend56_8(memory_load8_le(mem, bvadd64(R8, 49bv64))), (gamma_load8(Gamma_mem, bvadd64(R8, 49bv64)) || L(mem, bvadd64(R8, 49bv64))); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R9[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R9); + assume {:captureState "addr:0x720"}true; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), 0bv8), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), true); + assume {:captureState "addr:0x724"}true; R10, Gamma_R10 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 50bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R9, 50bv64), R10[8:0]), gamma_store8(Gamma_mem, bvadd64(R9, 50bv64), Gamma_R10); + assume {:captureState "addr:0x730"}true; call rely(); R8, Gamma_R8 := zero_extend56_8(memory_load8_le(mem, bvadd64(R8, 49bv64))), (gamma_load8(Gamma_mem, bvadd64(R8, 49bv64)) || L(mem, bvadd64(R8, 49bv64))); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R8[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R8); + assume {:captureState "addr:0x738"}true; R8, Gamma_R8 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); call rely(); assert (L(mem, bvadd64(R9, 50bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R9, 50bv64), R8[8:0]), gamma_store8(Gamma_mem, bvadd64(R9, 50bv64), Gamma_R8); + assume {:captureState "addr:0x740"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign3/clang_O2/basicassign3.expected b/src/test/incorrect/basicassign3/clang_O2/basicassign3.expected index 6d5a44168..89a0e981b 100644 --- a/src/test/incorrect/basicassign3/clang_O2/basicassign3.expected +++ b/src/test/incorrect/basicassign3/clang_O2/basicassign3.expected @@ -1,38 +1,38 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69684bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69684bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69688bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,12 +82,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R8, Gamma_R9, Gamma_mem, R0, R8, R9, mem; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -179,6 +179,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -187,5 +188,6 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R9, 56bv64), R8[8:0]), gamma_store8(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; return; } diff --git a/src/test/incorrect/basicassign3/clang_no_plt_no_pic/basicassign3.expected b/src/test/incorrect/basicassign3/clang_no_plt_no_pic/basicassign3.expected index 55e019ce2..1f09e5048 100644 --- a/src/test/incorrect/basicassign3/clang_no_plt_no_pic/basicassign3.expected +++ b/src/test/incorrect/basicassign3/clang_no_plt_no_pic/basicassign3.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69681bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69682bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69681bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69682bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -187,24 +187,30 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 69632bv64, true; call rely(); R9, Gamma_R9 := zero_extend56_8(memory_load8_le(mem, bvadd64(R8, 49bv64))), (gamma_load8(Gamma_mem, bvadd64(R8, 49bv64)) || L(mem, bvadd64(R8, 49bv64))); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R9[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R9); + assume {:captureState "addr:0x720"}true; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), 0bv8), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), true); + assume {:captureState "addr:0x724"}true; R10, Gamma_R10 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 50bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R9, 50bv64), R10[8:0]), gamma_store8(Gamma_mem, bvadd64(R9, 50bv64), Gamma_R10); + assume {:captureState "addr:0x730"}true; call rely(); R8, Gamma_R8 := zero_extend56_8(memory_load8_le(mem, bvadd64(R8, 49bv64))), (gamma_load8(Gamma_mem, bvadd64(R8, 49bv64)) || L(mem, bvadd64(R8, 49bv64))); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R8[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R8); + assume {:captureState "addr:0x738"}true; R8, Gamma_R8 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); call rely(); assert (L(mem, bvadd64(R9, 50bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R9, 50bv64), R8[8:0]), gamma_store8(Gamma_mem, bvadd64(R9, 50bv64), Gamma_R8); + assume {:captureState "addr:0x740"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign3/clang_pic/basicassign3.expected b/src/test/incorrect/basicassign3/clang_pic/basicassign3.expected index 3d210d1e5..fde803357 100644 --- a/src/test/incorrect/basicassign3/clang_pic/basicassign3.expected +++ b/src/test/incorrect/basicassign3/clang_pic/basicassign3.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69681bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69682bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R10: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R10: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69681bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69682bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,7 +103,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -112,12 +112,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R10, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R10, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -243,6 +243,7 @@ procedure main() free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 65536bv64, true; call rely(); @@ -250,7 +251,9 @@ procedure main() call rely(); R9, Gamma_R9 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R9[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R9); + assume {:captureState "addr:0x764"}true; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), 0bv8), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), true); + assume {:captureState "addr:0x768"}true; R10, Gamma_R10 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); R9, Gamma_R9 := 65536bv64, true; call rely(); @@ -258,13 +261,16 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R10); mem, Gamma_mem := memory_store8_le(mem, R9, R10[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R10); + assume {:captureState "addr:0x778"}true; call rely(); R8, Gamma_R8 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R8[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R8); + assume {:captureState "addr:0x780"}true; R8, Gamma_R8 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); + assume {:captureState "addr:0x788"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign3/gcc/basicassign3.expected b/src/test/incorrect/basicassign3/gcc/basicassign3.expected index a49f59087..fcdcec215 100644 --- a/src/test/incorrect/basicassign3/gcc/basicassign3.expected +++ b/src/test/incorrect/basicassign3/gcc/basicassign3.expected @@ -1,40 +1,40 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69650bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69649bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69650bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69649bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,12 +84,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -183,30 +183,36 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 18bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); + assume {:captureState "addr:0x724"}true; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), 0bv8), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), true); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 17bv64), Gamma_R0; R1, Gamma_R1 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 18bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 17bv64), Gamma_R0; R1, Gamma_R1 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x758"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign3/gcc_O2/basicassign3.expected b/src/test/incorrect/basicassign3/gcc_O2/basicassign3.expected index 2ec31149a..135aac2e1 100644 --- a/src/test/incorrect/basicassign3/gcc_O2/basicassign3.expected +++ b/src/test/incorrect/basicassign3/gcc_O2/basicassign3.expected @@ -1,38 +1,38 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69650bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69649bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R2: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R2: bv64; +var {:extern }mem: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69650bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69649bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,12 +82,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R2, Gamma_mem, R0, R1, R2, mem; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -179,6 +179,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x600"}true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 17bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; @@ -187,5 +188,6 @@ procedure main() call rely(); assert (L(mem, bvadd64(R1, 17bv64)) ==> Gamma_R2); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R1, 17bv64), R2[8:0]), gamma_store8(Gamma_mem, bvadd64(R1, 17bv64), Gamma_R2); + assume {:captureState "addr:0x610"}true; return; } diff --git a/src/test/incorrect/basicassign3/gcc_no_plt_no_pic/basicassign3.expected b/src/test/incorrect/basicassign3/gcc_no_plt_no_pic/basicassign3.expected index a49f59087..fcdcec215 100644 --- a/src/test/incorrect/basicassign3/gcc_no_plt_no_pic/basicassign3.expected +++ b/src/test/incorrect/basicassign3/gcc_no_plt_no_pic/basicassign3.expected @@ -1,40 +1,40 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69650bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69649bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69650bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69649bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,12 +84,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -183,30 +183,36 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 18bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); + assume {:captureState "addr:0x724"}true; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), 0bv8), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), true); + assume {:captureState "addr:0x728"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 17bv64), Gamma_R0; R1, Gamma_R1 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 18bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 17bv64), Gamma_R0; R1, Gamma_R1 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x758"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign3/gcc_pic/basicassign3.expected b/src/test/incorrect/basicassign3/gcc_pic/basicassign3.expected index 790a28a7a..d9fd7da84 100644 --- a/src/test/incorrect/basicassign3/gcc_pic/basicassign3.expected +++ b/src/test/incorrect/basicassign3/gcc_pic/basicassign3.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; -axiom {:extern } ($secret_addr == 69650bv64); -const {:extern } $z_addr: bv64; -axiom {:extern } ($z_addr == 69649bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +const {:extern }$secret_addr: bv64; +axiom {:extern }($secret_addr == 69650bv64); +const {:extern }$z_addr: bv64; +axiom {:extern }($z_addr == 69649bv64); +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -99,7 +99,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -108,12 +108,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -239,6 +239,7 @@ procedure main() free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -246,7 +247,9 @@ procedure main() call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); + assume {:captureState "addr:0x764"}true; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), 0bv8), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), true); + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -254,12 +257,14 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x778"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); + assume {:captureState "addr:0x788"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -267,6 +272,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x798"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/iflocal/clang/iflocal.expected b/src/test/incorrect/iflocal/clang/iflocal.expected index ed1899391..5c063e7f9 100644 --- a/src/test/incorrect/iflocal/clang/iflocal.expected +++ b/src/test/incorrect/iflocal/clang/iflocal.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -186,22 +186,26 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x71c"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 0bv33))), (Gamma_R8 && Gamma_#4); @@ -227,12 +231,16 @@ procedure main() } goto l00000359; l00000359: + assume {:captureState "addr:0x738"}true; goto l0000035a; l0000035a: + assume {:captureState "addr:0x73c"}true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x740"}true; goto l00000342; l00000342: + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/iflocal/clang_no_plt_no_pic/iflocal.expected b/src/test/incorrect/iflocal/clang_no_plt_no_pic/iflocal.expected index 503ea3a02..5f5666bf5 100644 --- a/src/test/incorrect/iflocal/clang_no_plt_no_pic/iflocal.expected +++ b/src/test/incorrect/iflocal/clang_no_plt_no_pic/iflocal.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -186,22 +186,26 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x71c"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 0bv33))), (Gamma_R8 && Gamma_#4); @@ -227,12 +231,16 @@ procedure main() } goto l0000097b; l0000097b: + assume {:captureState "addr:0x738"}true; goto l0000097c; l0000097c: + assume {:captureState "addr:0x73c"}true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x740"}true; goto l00000964; l00000964: + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/iflocal/clang_pic/iflocal.expected b/src/test/incorrect/iflocal/clang_pic/iflocal.expected index 503ea3a02..5f5666bf5 100644 --- a/src/test/incorrect/iflocal/clang_pic/iflocal.expected +++ b/src/test/incorrect/iflocal/clang_pic/iflocal.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,12 +88,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_stack, R0, R31, R8, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -186,22 +186,26 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x71c"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x724"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 0bv33))), (Gamma_R8 && Gamma_#4); @@ -227,12 +231,16 @@ procedure main() } goto l0000097b; l0000097b: + assume {:captureState "addr:0x738"}true; goto l0000097c; l0000097c: + assume {:captureState "addr:0x73c"}true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x740"}true; goto l00000964; l00000964: + assume {:captureState "addr:0x748"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/iflocal/gcc/iflocal.expected b/src/test/incorrect/iflocal/gcc/iflocal.expected index 7ec2d4338..d43055f8c 100644 --- a/src/test/incorrect/iflocal/gcc/iflocal.expected +++ b/src/test/incorrect/iflocal/gcc/iflocal.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,12 +86,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -184,21 +184,24 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -211,10 +214,13 @@ procedure main() } goto l0000032d; l0000032d: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x734"}true; goto l00000318; l00000318: + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/incorrect/iflocal/gcc_no_plt_no_pic/iflocal.expected b/src/test/incorrect/iflocal/gcc_no_plt_no_pic/iflocal.expected index 76c43f004..689afa450 100644 --- a/src/test/incorrect/iflocal/gcc_no_plt_no_pic/iflocal.expected +++ b/src/test/incorrect/iflocal/gcc_no_plt_no_pic/iflocal.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,12 +86,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -184,21 +184,24 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -211,10 +214,13 @@ procedure main() } goto l00000914; l00000914: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x734"}true; goto l000008ff; l000008ff: + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/incorrect/iflocal/gcc_pic/iflocal.expected b/src/test/incorrect/iflocal/gcc_pic/iflocal.expected index 76c43f004..689afa450 100644 --- a/src/test/incorrect/iflocal/gcc_pic/iflocal.expected +++ b/src/test/incorrect/iflocal/gcc_pic/iflocal.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,12 +86,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_stack, R0, R31, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -184,21 +184,24 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x720"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -211,10 +214,13 @@ procedure main() } goto l00000914; l00000914: + assume {:captureState "addr:0x730"}true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x734"}true; goto l000008ff; l000008ff: + assume {:captureState "addr:0x738"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/incorrect/nestedifglobal/clang/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/clang/nestedifglobal.expected index bd481a087..21e0caf09 100644 --- a/src/test/incorrect/nestedifglobal/clang/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/clang/nestedifglobal.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,12 +94,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -192,30 +192,35 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x71c"}true; R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); + assume {:captureState "addr:0x728"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), true); + assume {:captureState "addr:0x72c"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; @@ -242,12 +247,16 @@ procedure main() } goto l0000045d; l0000045d: + assume {:captureState "addr:0x740"}true; goto l0000045e; l0000045e: + assume {:captureState "addr:0x744"}true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x748"}true; goto l0000039e; l0000039e: + assume {:captureState "addr:0x750"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -275,12 +284,16 @@ procedure main() } goto l00000448; l00000448: + assume {:captureState "addr:0x764"}true; goto l00000449; l00000449: + assume {:captureState "addr:0x768"}true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x76c"}true; goto l000003dc; l000003dc: + assume {:captureState "addr:0x774"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #6, Gamma_#6 := bvadd32(R8[32:0], 4294967292bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934589bv33))), (Gamma_R8 && Gamma_#6); @@ -306,14 +319,18 @@ procedure main() } goto l0000042c; l0000042c: + assume {:captureState "addr:0x784"}true; goto l0000042d; l0000042d: + assume {:captureState "addr:0x788"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x790"}true; goto l00000415; l00000415: + assume {:captureState "addr:0x798"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/nestedifglobal/clang_no_plt_no_pic/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/clang_no_plt_no_pic/nestedifglobal.expected index 9a8dfd5ea..caf8a93dd 100644 --- a/src/test/incorrect/nestedifglobal/clang_no_plt_no_pic/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/clang_no_plt_no_pic/nestedifglobal.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,12 +94,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -192,30 +192,35 @@ procedure main() free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); + assume {:captureState "addr:0x718"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); + assume {:captureState "addr:0x71c"}true; R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); + assume {:captureState "addr:0x728"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), true); + assume {:captureState "addr:0x72c"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; @@ -242,12 +247,16 @@ procedure main() } goto l00000bad; l00000bad: + assume {:captureState "addr:0x740"}true; goto l00000bae; l00000bae: + assume {:captureState "addr:0x744"}true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x748"}true; goto l00000aee; l00000aee: + assume {:captureState "addr:0x750"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -275,12 +284,16 @@ procedure main() } goto l00000b98; l00000b98: + assume {:captureState "addr:0x764"}true; goto l00000b99; l00000b99: + assume {:captureState "addr:0x768"}true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x76c"}true; goto l00000b2c; l00000b2c: + assume {:captureState "addr:0x774"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #6, Gamma_#6 := bvadd32(R8[32:0], 4294967292bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934589bv33))), (Gamma_R8 && Gamma_#6); @@ -306,14 +319,18 @@ procedure main() } goto l00000b7c; l00000b7c: + assume {:captureState "addr:0x784"}true; goto l00000b7d; l00000b7d: + assume {:captureState "addr:0x788"}true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); + assume {:captureState "addr:0x790"}true; goto l00000b65; l00000b65: + assume {:captureState "addr:0x798"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/nestedifglobal/clang_pic/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/clang_pic/nestedifglobal.expected index 4be29dbcc..27a6c476e 100644 --- a/src/test/incorrect/nestedifglobal/clang_pic/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/clang_pic/nestedifglobal.expected @@ -1,66 +1,66 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_R8: bool; +var {:extern }Gamma_R9: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R31: bv64; +var {:extern }R8: bv64; +var {:extern }R9: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -117,7 +117,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -126,12 +126,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack; free requires (memory_load8_le(mem, 69664bv64) == 0bv8); free requires (memory_load8_le(mem, 69665bv64) == 0bv8); @@ -256,33 +256,39 @@ procedure main() free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4040bv64)) || L(mem, bvadd64(R8, 4040bv64))); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); + assume {:captureState "addr:0x760"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); + assume {:captureState "addr:0x764"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); + assume {:captureState "addr:0x768"}true; R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); assert (L(mem, R8) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, R8, R9[32:0]), gamma_store32(Gamma_mem, R8, Gamma_R9); + assume {:captureState "addr:0x770"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), true); + assume {:captureState "addr:0x774"}true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; @@ -309,12 +315,16 @@ procedure main() } goto l00000481; l00000481: + assume {:captureState "addr:0x788"}true; goto l00000482; l00000482: + assume {:captureState "addr:0x78c"}true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R8); + assume {:captureState "addr:0x790"}true; goto l000003b9; l000003b9: + assume {:captureState "addr:0x798"}true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -342,12 +352,16 @@ procedure main() } goto l0000046c; l0000046c: + assume {:captureState "addr:0x7ac"}true; goto l0000046d; l0000046d: + assume {:captureState "addr:0x7b0"}true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R8); + assume {:captureState "addr:0x7b4"}true; goto l000003f9; l000003f9: + assume {:captureState "addr:0x7bc"}true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); #6, Gamma_#6 := bvadd32(R8[32:0], 4294967292bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934589bv33))), (Gamma_R8 && Gamma_#6); @@ -373,16 +387,20 @@ procedure main() } goto l00000449; l00000449: + assume {:captureState "addr:0x7cc"}true; goto l0000044a; l0000044a: + assume {:captureState "addr:0x7d0"}true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R8); + assume {:captureState "addr:0x7dc"}true; goto l00000432; l00000432: + assume {:captureState "addr:0x7e4"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/incorrect/nestedifglobal/gcc/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/gcc/nestedifglobal.expected index 0dc929fa0..0401c2770 100644 --- a/src/test/incorrect/nestedifglobal/gcc/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/gcc/nestedifglobal.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,12 +92,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -190,30 +190,34 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x728"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -229,10 +233,13 @@ procedure main() } goto l00000414; l00000414: + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x748"}true; goto l00000381; l00000381: + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -248,10 +255,13 @@ procedure main() } goto l00000407; l00000407: + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x764"}true; goto l000003b2; l000003b2: + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#6); @@ -264,13 +274,16 @@ procedure main() } goto l000003ed; l000003ed: + assume {:captureState "addr:0x774"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x780"}true; goto l000003d8; l000003d8: + assume {:captureState "addr:0x784"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/incorrect/nestedifglobal/gcc_no_plt_no_pic/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/gcc_no_plt_no_pic/nestedifglobal.expected index e4413bb14..234bd851e 100644 --- a/src/test/incorrect/nestedifglobal/gcc_no_plt_no_pic/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/gcc_no_plt_no_pic/nestedifglobal.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,12 +92,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -190,30 +190,34 @@ procedure main() free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x714"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x718"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x728"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); + assume {:captureState "addr:0x72c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -229,10 +233,13 @@ procedure main() } goto l00000b0c; l00000b0c: + assume {:captureState "addr:0x744"}true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x748"}true; goto l00000a79; l00000a79: + assume {:captureState "addr:0x74c"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -248,10 +255,13 @@ procedure main() } goto l00000aff; l00000aff: + assume {:captureState "addr:0x760"}true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x764"}true; goto l00000aaa; l00000aaa: + assume {:captureState "addr:0x768"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#6); @@ -264,13 +274,16 @@ procedure main() } goto l00000ae5; l00000ae5: + assume {:captureState "addr:0x774"}true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x780"}true; goto l00000ad0; l00000ad0: + assume {:captureState "addr:0x784"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/incorrect/nestedifglobal/gcc_pic/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/gcc_pic/nestedifglobal.expected index 66d18d1b9..28dd0b805 100644 --- a/src/test/incorrect/nestedifglobal/gcc_pic/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/gcc_pic/nestedifglobal.expected @@ -1,56 +1,56 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern }Gamma_R0: bool; +var {:extern }Gamma_R1: bool; +var {:extern }Gamma_R31: bool; +var {:extern }Gamma_mem: [bv64]bool; +var {:extern }Gamma_stack: [bv64]bool; +var {:extern }R0: bv64; +var {:extern }R1: bv64; +var {:extern }R31: bv64; +var {:extern }mem: [bv64]bv8; +var {:extern }stack: [bv64]bv8; +function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); +function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); +procedure {:extern }rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -107,7 +107,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern }rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -116,12 +116,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern }rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern }guarantee_reflexive(); modifies Gamma_mem, mem; -procedure main() +procedure main() modifies Gamma_R0, Gamma_R1, Gamma_R31, Gamma_mem, Gamma_stack, R0, R1, R31, mem, stack; free requires (memory_load8_le(mem, 69632bv64) == 0bv8); free requires (memory_load8_le(mem, 69633bv64) == 0bv8); @@ -246,23 +246,25 @@ procedure main() free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { - var #4: bv32; - var #5: bv32; - var #6: bv32; - var CF: bv1; - var Gamma_#4: bool; - var Gamma_#5: bool; - var Gamma_#6: bool; - var Gamma_CF: bool; - var Gamma_NF: bool; - var Gamma_VF: bool; - var Gamma_ZF: bool; - var NF: bv1; - var VF: bv1; - var ZF: bv1; + var #4: bv32; + var #5: bv32; + var #6: bv32; + var CF: bv1; + var Gamma_#4: bool; + var Gamma_#5: bool; + var Gamma_#6: bool; + var Gamma_CF: bool; + var Gamma_NF: bool; + var Gamma_VF: bool; + var Gamma_ZF: bool; + var NF: bv1; + var VF: bv1; + var ZF: bv1; lmain: + assume {:captureState "addr:0x754"}true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); + assume {:captureState "addr:0x758"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -270,7 +272,9 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); + assume {:captureState "addr:0x768"}true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); + assume {:captureState "addr:0x76c"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -287,10 +291,13 @@ procedure main() } goto l00000418; l00000418: + assume {:captureState "addr:0x784"}true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x788"}true; goto l00000383; l00000383: + assume {:captureState "addr:0x78c"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -307,10 +314,13 @@ procedure main() } goto l0000040b; l0000040b: + assume {:captureState "addr:0x7a0"}true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x7a4"}true; goto l000003b5; l000003b5: + assume {:captureState "addr:0x7a8"}true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#6); @@ -323,14 +333,17 @@ procedure main() } goto l000003f0; l000003f0: + assume {:captureState "addr:0x7b4"}true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); + assume {:captureState "addr:0x7c0"}true; goto l000003db; l000003db: + assume {:captureState "addr:0x7c4"}true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; From 85de3c71fb26eb804557149839c5d93f3bfe47b4 Mon Sep 17 00:00:00 2001 From: Alistair Michael Date: Mon, 30 Oct 2023 14:10:27 +1000 Subject: [PATCH 05/11] use BAP Tid for state instead of binary address --- src/main/scala/ir/Statement.scala | 4 ++-- src/main/scala/translating/BAPToIR.scala | 4 ++-- src/main/scala/translating/IRToBoogie.scala | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/scala/ir/Statement.scala b/src/main/scala/ir/Statement.scala index 8a8808b15..42a384eed 100644 --- a/src/main/scala/ir/Statement.scala +++ b/src/main/scala/ir/Statement.scala @@ -10,7 +10,7 @@ trait Statement extends Command { ) } -case class LocalAssign(var lhs: Variable, var rhs: Expr, val address: Option[Int] = None) extends Statement { +case class LocalAssign(var lhs: Variable, var rhs: Expr, val label: Option[String] = None) extends Statement { //override def locals: Set[Variable] = rhs.locals + lhs override def modifies: Set[Global] = lhs match { case r: Register => Set(r) @@ -20,7 +20,7 @@ case class LocalAssign(var lhs: Variable, var rhs: Expr, val address: Option[Int override def acceptVisit(visitor: Visitor): Statement = visitor.visitLocalAssign(this) } -case class MemoryAssign(var lhs: Memory, var rhs: MemoryStore, val address: Option[Int] = None) extends Statement { +case class MemoryAssign(var lhs: Memory, var rhs: MemoryStore, val label: Option[String] = None) extends Statement { override def modifies: Set[Global] = Set(lhs) //override def locals: Set[Variable] = rhs.locals override def toString: String = s"$lhs := $rhs" diff --git a/src/main/scala/translating/BAPToIR.scala b/src/main/scala/translating/BAPToIR.scala index 62c9e5ab4..73be03222 100644 --- a/src/main/scala/translating/BAPToIR.scala +++ b/src/main/scala/translating/BAPToIR.scala @@ -60,8 +60,8 @@ class BAPToIR(var program: BAPProgram, mainAddress: Int) { } private def translate(s: BAPStatement) = s match { - case b: BAPMemAssign => MemoryAssign(b.lhs.toIR, b.rhs.toIR, b.address) - case b: BAPLocalAssign => LocalAssign(b.lhs.toIR, b.rhs.toIR, b.address) + case b: BAPMemAssign => MemoryAssign(b.lhs.toIR, b.rhs.toIR, Some(b.line)) + case b: BAPLocalAssign => LocalAssign(b.lhs.toIR, b.rhs.toIR, Some(b.line)) case _ => throw new Exception("unsupported statement: " + s) } diff --git a/src/main/scala/translating/IRToBoogie.scala b/src/main/scala/translating/IRToBoogie.scala index 3e3193833..5b76ebd3e 100644 --- a/src/main/scala/translating/IRToBoogie.scala +++ b/src/main/scala/translating/IRToBoogie.scala @@ -319,7 +319,7 @@ class IRToBoogie(var program: Program, var spec: Specification) { def translateBlock(b: Block): BBlock = { val cmds = (b.address match { - case Some(addr) => List(getCaptureStateStatement(s"addr:0x${addr.toHexString}")) + case Some(addr) => List(getCaptureStateStatement(s"addr:${b.label}")) case _ => List.empty }) ++ (b.statements.flatMap(s => translate(s)) ++ b.jumps.flatMap(j => translate(j))) @@ -379,8 +379,8 @@ class IRToBoogie(var program: Program, var spec: Specification) { val rhsGamma = m.rhs.toGamma val store = AssignCmd(List(lhs, lhsGamma), List(rhs, rhsGamma)) val stateSplit = s match { - case MemoryAssign (_,_, Some(addr)) => List(getCaptureStateStatement(s"addr:0x${addr.toHexString}")) - case LocalAssign(_,_, Some(addr)) => List(getCaptureStateStatement(s"addr:0x${addr.toHexString}")) + case MemoryAssign (_,_, Some(label)) => List(getCaptureStateStatement(s"${label}")) + case LocalAssign(_,_, Some(label)) => List(getCaptureStateStatement(s"${label}")) case _ => List.empty } if (lhs == stack) { From 68c0336edeb1c33b6b888f399e88ab99db6c7ba9 Mon Sep 17 00:00:00 2001 From: Alistair Michael Date: Tue, 31 Oct 2023 16:10:56 +1000 Subject: [PATCH 06/11] Add extractors --- src/main/scala/ir/Statement.scala | 52 ++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/src/main/scala/ir/Statement.scala b/src/main/scala/ir/Statement.scala index 42a384eed..412212605 100644 --- a/src/main/scala/ir/Statement.scala +++ b/src/main/scala/ir/Statement.scala @@ -10,7 +10,7 @@ trait Statement extends Command { ) } -case class LocalAssign(var lhs: Variable, var rhs: Expr, val label: Option[String] = None) extends Statement { +class LocalAssign(var lhs: Variable, var rhs: Expr, val label: Option[String] = None) extends Statement { //override def locals: Set[Variable] = rhs.locals + lhs override def modifies: Set[Global] = lhs match { case r: Register => Set(r) @@ -20,36 +20,53 @@ case class LocalAssign(var lhs: Variable, var rhs: Expr, val label: Option[Strin override def acceptVisit(visitor: Visitor): Statement = visitor.visitLocalAssign(this) } -case class MemoryAssign(var lhs: Memory, var rhs: MemoryStore, val label: Option[String] = None) extends Statement { + +object LocalAssign: + def apply(lhs: Variable, rhs: Expr, label: Option[String]) = new LocalAssign(lhs, rhs, label) + def unapply(l: LocalAssign) : Option[(Variable, Expr, Option[String])] = Some(l.lhs, l.rhs, l.label) + +class MemoryAssign(var lhs: Memory, var rhs: MemoryStore, val label: Option[String] = None) extends Statement { override def modifies: Set[Global] = Set(lhs) //override def locals: Set[Variable] = rhs.locals override def toString: String = s"$lhs := $rhs" override def acceptVisit(visitor: Visitor): Statement = visitor.visitMemoryAssign(this) } +object MemoryAssign: + def apply(lhs: Memory, rhs: MemoryStore, label: Option[String]) = new MemoryAssign(lhs, rhs, label) + def unapply(m: MemoryAssign) : Option[(Memory, MemoryStore, Option[String])] = Some(m.lhs, m.rhs, m.label) + case object NOP extends Statement { override def toString: String = "" override def acceptVisit(visitor: Visitor): Statement = this } -case class Assume(var body: Expr, var comment: Option[String]) extends Statement { +class Assume(var body: Expr, var comment: Option[String]) extends Statement { override def toString: String = s"assume $body" + comment.map(" //" + _) override def acceptVisit(visitor: Visitor): Statement = visitor.visitAssume(this) } -case class Assert(var body: Expr, var comment: Option[String]) extends Statement { +object Assume: + def apply(body: Expr, comment: Option[String]) = new Assume(body, comment) + def unapply(a: Assume) : Option[(Expr, Option[String])] = Some(a.body, a.comment) + + +class Assert(var body: Expr, var comment: Option[String]) extends Statement { override def toString: String = s"assert $body" + comment.map(" //" + _) override def acceptVisit(visitor: Visitor): Statement = visitor.visitAssert(this) } +object Assert: + def apply(body: Expr, comment: Option[String]) : Assert = new Assert(body, comment) + def unapply(a: Assert) : Option[(Expr, Option[String])] = Some(a.body, a.comment) + trait Jump extends Command { def modifies: Set[Global] = Set() //def locals: Set[Variable] = Set() def calls: Set[Procedure] = Set() def acceptVisit(visitor: Visitor): Jump = throw new Exception("visitor " + visitor + " unimplemented for: " + this) } - -case class GoTo(var target: Block, var condition: Option[Expr]) extends Jump { +class GoTo(var target: Block, var condition: Option[Expr]) extends Jump { /* override def locals: Set[Variable] = condition match { case Some(c) => c.locals case None => Set() @@ -59,7 +76,12 @@ case class GoTo(var target: Block, var condition: Option[Expr]) extends Jump { override def acceptVisit(visitor: Visitor): Jump = visitor.visitGoTo(this) } -case class DirectCall(var target: Procedure, var condition: Option[Expr], var returnTarget: Option[Block], val address: Option[Int] = None) extends Jump { +object GoTo: + def apply(target: Block, condition: Option[Expr]) = new GoTo(target, condition) + + def unapply(g: GoTo) : Option[(Block, Option[Expr])]= Some(g.target, g.condition) + +class DirectCall(var target: Procedure, var condition: Option[Expr], var returnTarget: Option[Block], val address: Option[Int] = None) extends Jump { /* override def locals: Set[Variable] = condition match { case Some(c) => c.locals case None => Set() @@ -69,7 +91,15 @@ case class DirectCall(var target: Procedure, var condition: Option[Expr], var re override def acceptVisit(visitor: Visitor): Jump = visitor.visitDirectCall(this) } -case class IndirectCall(var target: Variable, var condition: Option[Expr], var returnTarget: Option[Block], + +object DirectCall: + def apply(target: Procedure, condition: Option[Expr], returnTarget: Option[Block], address: Option[Int] = None) + = new DirectCall(target, condition, returnTarget, address) + + def unapply(i: DirectCall): Option[(Procedure, Option[Expr], Option[Block], Option[Int])] = Some(i.target, i.condition, i.returnTarget, i.address) + + +class IndirectCall(var target: Variable, var condition: Option[Expr], var returnTarget: Option[Block], val address: Option[Int] = None) extends Jump { /* override def locals: Set[Variable] = condition match { case Some(c) => c.locals + target @@ -78,3 +108,9 @@ case class IndirectCall(var target: Variable, var condition: Option[Expr], var r override def toString: String = s"IndirectCall($target, $condition, ${returnTarget.map(_.label)})" override def acceptVisit(visitor: Visitor): Jump = visitor.visitIndirectCall(this) } + +object IndirectCall: + def apply(target: Variable, condition: Option[Expr], returnTarget: Option[Block], address: Option[Int] = None) + = new IndirectCall(target, condition, returnTarget, address) + + def unapply(i: IndirectCall): Option[(Variable, Option[Expr], Option[Block], Option[Int])] = Some(i.target, i.condition, i.returnTarget, i.address) \ No newline at end of file From 6ed9c4228180c724b004caa3271935ac01e5b881 Mon Sep 17 00:00:00 2001 From: Alistair Michael Date: Tue, 31 Oct 2023 16:40:19 +1000 Subject: [PATCH 07/11] remove extern axioms --- src/main/scala/boogie/BCmd.scala | 2 +- src/main/scala/boogie/BProgram.scala | 2 +- src/main/scala/specification/Specification.scala | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/scala/boogie/BCmd.scala b/src/main/scala/boogie/BCmd.scala index 0415bb875..1144fbfa8 100644 --- a/src/main/scala/boogie/BCmd.scala +++ b/src/main/scala/boogie/BCmd.scala @@ -24,7 +24,7 @@ sealed trait BCmd() extends BCmdOrBlock { def attributes: List[(String, String)] val attrString: String = if (attributes.nonEmpty) then { - attributes.map(a => s"{${a._1} ${a._2}}").mkString(" ") + (attributes.map(a => s"{${a._1} ${a._2}}").mkString(" ")) + " " } else { "" } diff --git a/src/main/scala/boogie/BProgram.scala b/src/main/scala/boogie/BProgram.scala index fd21fbe11..01d1db818 100644 --- a/src/main/scala/boogie/BProgram.scala +++ b/src/main/scala/boogie/BProgram.scala @@ -9,7 +9,7 @@ trait BDeclaration() { def toBoogie: List[String] = List(toString) val attrString: String = if (attributes.nonEmpty) then { - attributes.map(a => s"{${a._1} ${a._2}}").mkString(" ") + attributes.map(a => s"{${a._1} ${a._2}}").mkString(" ") + " " } else { "" } diff --git a/src/main/scala/specification/Specification.scala b/src/main/scala/specification/Specification.scala index fc0307c94..754d0e43b 100644 --- a/src/main/scala/specification/Specification.scala +++ b/src/main/scala/specification/Specification.scala @@ -23,7 +23,7 @@ case class SpecGlobal(name: String, override val size: Int, arraySize: Option[In override val toAddrVar: BVar = BVariable("$" + s"${name}_addr", BitVecBType(64), Scope.Const) override val toOldVar: BVar = BVariable(s"${name}_old", BitVecBType(size), Scope.Local) override val toOldGamma: BVar = BVariable(s"Gamma_${name}_old", BoolBType, Scope.Local) - val toAxiom: BAxiom = BAxiom(BinaryBExpr(BoolEQ, toAddrVar, BitVecBLiteral(address, 64)), List((":extern", ""))) + val toAxiom: BAxiom = BAxiom(BinaryBExpr(BoolEQ, toAddrVar, BitVecBLiteral(address, 64)), List.empty) override def resolveSpec: BMemoryLoad = BMemoryLoad( BMapVar("mem", MapBType(BitVecBType(64), BitVecBType(8)), Scope.Global), toAddrVar, From 69353b8e016d0d0b14a27a54b61d38bf4c1c1681 Mon Sep 17 00:00:00 2001 From: Alistair Michael Date: Wed, 1 Nov 2023 10:19:38 +1000 Subject: [PATCH 08/11] update expected --- .../clang/arrays_simple.expected | 54 ++--- .../clang_O2/arrays_simple.expected | 24 +-- .../arrays_simple.expected | 54 ++--- .../clang_pic/arrays_simple.expected | 54 ++--- .../gcc_O2/arrays_simple.expected | 24 +-- .../clang/basic_arrays_read.expected | 54 ++--- .../clang_O2/basic_arrays_read.expected | 40 ++-- .../basic_arrays_read.expected | 54 ++--- .../clang_pic/basic_arrays_read.expected | 58 ++--- .../gcc/basic_arrays_read.expected | 40 ++-- .../gcc_O2/basic_arrays_read.expected | 40 ++-- .../basic_arrays_read.expected | 40 ++-- .../gcc_pic/basic_arrays_read.expected | 44 ++-- .../clang/basic_arrays_write.expected | 58 ++--- .../clang_O2/basic_arrays_write.expected | 46 ++-- .../basic_arrays_write.expected | 58 ++--- .../clang_pic/basic_arrays_write.expected | 62 +++--- .../gcc/basic_arrays_write.expected | 54 ++--- .../gcc_O2/basic_arrays_write.expected | 46 ++-- .../basic_arrays_write.expected | 54 ++--- .../gcc_pic/basic_arrays_write.expected | 58 ++--- .../clang/basic_assign_assign.expected | 44 ++-- .../clang_O2/basic_assign_assign.expected | 44 ++-- .../basic_assign_assign.expected | 44 ++-- .../clang_pic/basic_assign_assign.expected | 48 ++--- .../gcc/basic_assign_assign.expected | 40 ++-- .../gcc_O2/basic_assign_assign.expected | 44 ++-- .../basic_assign_assign.expected | 40 ++-- .../gcc_pic/basic_assign_assign.expected | 44 ++-- .../clang/basic_assign_increment.expected | 50 ++--- .../clang_O2/basic_assign_increment.expected | 50 ++--- .../basic_assign_increment.expected | 50 ++--- .../clang_pic/basic_assign_increment.expected | 54 ++--- .../gcc/basic_assign_increment.expected | 46 ++-- .../gcc_O2/basic_assign_increment.expected | 50 ++--- .../basic_assign_increment.expected | 46 ++-- .../gcc_pic/basic_assign_increment.expected | 50 ++--- .../clang/basic_function_call_caller.expected | 88 ++++---- .../basic_function_call_caller.expected | 58 ++--- .../basic_function_call_caller.expected | 88 ++++---- .../basic_function_call_caller.expected | 88 ++++---- .../gcc/basic_function_call_caller.expected | 84 ++++---- .../basic_function_call_caller.expected | 58 ++--- .../basic_function_call_caller.expected | 84 ++++---- .../basic_function_call_caller.expected | 84 ++++---- .../clang/basic_function_call_reader.expected | 86 ++++---- .../basic_function_call_reader.expected | 62 +++--- .../basic_function_call_reader.expected | 86 ++++---- .../basic_function_call_reader.expected | 90 ++++---- .../gcc/basic_function_call_reader.expected | 74 +++---- .../basic_function_call_reader.expected | 48 ++--- .../basic_function_call_reader.expected | 74 +++---- .../basic_function_call_reader.expected | 78 +++---- .../clang/basic_lock_read.expected | 84 ++++---- .../clang_O2/basic_lock_read.expected | 54 ++--- .../basic_lock_read.expected | 84 ++++---- .../clang_pic/basic_lock_read.expected | 88 ++++---- .../gcc/basic_lock_read.expected | 76 +++---- .../gcc_O2/basic_lock_read.expected | 56 ++--- .../basic_lock_read.expected | 76 +++---- .../gcc_pic/basic_lock_read.expected | 80 +++---- .../clang/basic_lock_security_read.expected | 82 +++---- .../basic_lock_security_read.expected | 62 +++--- .../basic_lock_security_read.expected | 82 +++---- .../basic_lock_security_read.expected | 86 ++++---- .../gcc/basic_lock_security_read.expected | 74 +++---- .../gcc_O2/basic_lock_security_read.expected | 54 ++--- .../basic_lock_security_read.expected | 74 +++---- .../gcc_pic/basic_lock_security_read.expected | 78 +++---- .../clang/basic_lock_security_write.expected | 72 +++---- .../basic_lock_security_write.expected | 52 ++--- .../basic_lock_security_write.expected | 72 +++---- .../basic_lock_security_write.expected | 76 +++---- .../gcc/basic_lock_security_write.expected | 64 +++--- .../gcc_O2/basic_lock_security_write.expected | 52 ++--- .../basic_lock_security_write.expected | 64 +++--- .../basic_lock_security_write.expected | 68 +++--- .../clang/basic_lock_unlock.expected | 50 ++--- .../clang_O2/basic_lock_unlock.expected | 54 ++--- .../basic_lock_unlock.expected | 50 ++--- .../clang_pic/basic_lock_unlock.expected | 54 ++--- .../gcc/basic_lock_unlock.expected | 46 ++-- .../gcc_O2/basic_lock_unlock.expected | 54 ++--- .../basic_lock_unlock.expected | 46 ++-- .../gcc_pic/basic_lock_unlock.expected | 50 ++--- .../clang/basic_loop_assign.expected | 48 ++--- .../clang_O2/basic_loop_assign.expected | 48 ++--- .../basic_loop_assign.expected | 48 ++--- .../clang_pic/basic_loop_assign.expected | 52 ++--- .../gcc/basic_loop_assign.expected | 44 ++-- .../gcc_O2/basic_loop_assign.expected | 48 ++--- .../basic_loop_assign.expected | 44 ++-- .../gcc_pic/basic_loop_assign.expected | 48 ++--- .../clang/basic_operation_evaluation.expected | 108 +++++----- .../basic_operation_evaluation.expected | 24 +-- .../basic_operation_evaluation.expected | 108 +++++----- .../basic_operation_evaluation.expected | 108 +++++----- .../gcc/basic_operation_evaluation.expected | 90 ++++---- .../basic_operation_evaluation.expected | 24 +-- .../basic_operation_evaluation.expected | 90 ++++---- .../basic_operation_evaluation.expected | 90 ++++---- .../clang/basic_sec_policy_read.expected | 82 +++---- .../clang_O2/basic_sec_policy_read.expected | 62 +++--- .../basic_sec_policy_read.expected | 82 +++---- .../clang_pic/basic_sec_policy_read.expected | 86 ++++---- .../gcc/basic_sec_policy_read.expected | 74 +++---- .../gcc_O2/basic_sec_policy_read.expected | 54 ++--- .../basic_sec_policy_read.expected | 74 +++---- .../gcc_pic/basic_sec_policy_read.expected | 78 +++---- .../clang/basic_sec_policy_write.expected | 72 +++---- .../clang_O2/basic_sec_policy_write.expected | 56 ++--- .../basic_sec_policy_write.expected | 72 +++---- .../clang_pic/basic_sec_policy_write.expected | 76 +++---- .../gcc/basic_sec_policy_write.expected | 64 +++--- .../gcc_O2/basic_sec_policy_write.expected | 56 ++--- .../basic_sec_policy_write.expected | 64 +++--- .../gcc_pic/basic_sec_policy_write.expected | 68 +++--- .../clang/basicassign_gamma0.expected | 52 ++--- .../clang_O2/basicassign_gamma0.expected | 52 ++--- .../basicassign_gamma0.expected | 52 ++--- .../clang_pic/basicassign_gamma0.expected | 56 ++--- .../gcc/basicassign_gamma0.expected | 48 ++--- .../gcc_O2/basicassign_gamma0.expected | 52 ++--- .../basicassign_gamma0.expected | 48 ++--- .../gcc_pic/basicassign_gamma0.expected | 52 ++--- .../basicfree/clang/basicfree.expected | 84 ++++---- .../basicfree/clang_O2/basicfree.expected | 20 +- .../clang_no_plt_no_pic/basicfree.expected | 84 ++++---- .../basicfree/clang_pic/basicfree.expected | 84 ++++---- .../correct/basicfree/gcc/basicfree.expected | 80 +++---- .../basicfree/gcc_O2/basicfree.expected | 20 +- .../gcc_no_plt_no_pic/basicfree.expected | 80 +++---- .../basicfree/gcc_pic/basicfree.expected | 80 +++---- src/test/correct/cjump/clang/cjump.expected | 90 ++++---- .../correct/cjump/clang_O2/cjump.expected | 58 ++--- .../cjump/clang_no_plt_no_pic/cjump.expected | 90 ++++---- .../correct/cjump/clang_pic/cjump.expected | 94 ++++---- src/test/correct/cjump/gcc/cjump.expected | 74 +++---- src/test/correct/cjump/gcc_O2/cjump.expected | 54 ++--- .../cjump/gcc_no_plt_no_pic/cjump.expected | 74 +++---- src/test/correct/cjump/gcc_pic/cjump.expected | 78 +++---- .../correct/function/clang/function.expected | 82 +++---- .../function/clang_O2/function.expected | 58 ++--- .../clang_no_plt_no_pic/function.expected | 82 +++---- .../function/clang_pic/function.expected | 82 +++---- .../correct/function/gcc/function.expected | 80 +++---- .../correct/function/gcc_O2/function.expected | 54 ++--- .../gcc_no_plt_no_pic/function.expected | 80 +++---- .../function/gcc_pic/function.expected | 80 +++---- .../function1/clang/function1.expected | 126 +++++------ .../function1/clang_O2/function1.expected | 104 ++++----- .../clang_no_plt_no_pic/function1.expected | 126 +++++------ .../function1/clang_pic/function1.expected | 126 +++++------ .../correct/function1/gcc/function1.expected | 116 +++++----- .../function1/gcc_O2/function1.expected | 96 ++++----- .../gcc_no_plt_no_pic/function1.expected | 116 +++++----- .../function1/gcc_pic/function1.expected | 116 +++++----- .../clang/functions_with_params.expected | 82 +++---- .../clang_O2/functions_with_params.expected | 24 +-- .../functions_with_params.expected | 82 +++---- .../clang_pic/functions_with_params.expected | 82 +++---- .../gcc/functions_with_params.expected | 78 +++---- .../gcc_O2/functions_with_params.expected | 24 +-- .../functions_with_params.expected | 78 +++---- .../gcc_pic/functions_with_params.expected | 78 +++---- .../ifbranches/clang/ifbranches.expected | 90 ++++---- .../ifbranches/clang_O2/ifbranches.expected | 42 ++-- .../clang_no_plt_no_pic/ifbranches.expected | 90 ++++---- .../ifbranches/clang_pic/ifbranches.expected | 90 ++++---- .../ifbranches/gcc/ifbranches.expected | 82 +++---- .../ifbranches/gcc_O2/ifbranches.expected | 38 ++-- .../gcc_no_plt_no_pic/ifbranches.expected | 82 +++---- .../ifbranches/gcc_pic/ifbranches.expected | 82 +++---- .../correct/ifglobal/clang/ifglobal.expected | 80 +++---- .../ifglobal/clang_O2/ifglobal.expected | 54 ++--- .../clang_no_plt_no_pic/ifglobal.expected | 80 +++---- .../ifglobal/clang_pic/ifglobal.expected | 84 ++++---- .../correct/ifglobal/gcc/ifglobal.expected | 64 +++--- .../correct/ifglobal/gcc_O2/ifglobal.expected | 52 ++--- .../gcc_no_plt_no_pic/ifglobal.expected | 64 +++--- .../ifglobal/gcc_pic/ifglobal.expected | 68 +++--- .../clang_O2/indirect_call.expected | 66 +++--- .../gcc_O2/indirect_call.expected | 68 +++--- .../clang/initialisation.expected | 104 ++++----- .../clang_O2/initialisation.expected | 108 +++++----- .../initialisation.expected | 104 ++++----- .../clang_pic/initialisation.expected | 100 ++++----- .../gcc/initialisation.expected | 80 +++---- .../gcc_O2/initialisation.expected | 100 ++++----- .../gcc_no_plt_no_pic/initialisation.expected | 80 +++---- .../gcc_pic/initialisation.expected | 80 +++---- .../jumptable/clang_O2/jumptable.expected | 54 ++--- .../jumptable/gcc_O2/jumptable.expected | 94 ++++---- .../jumptable3/gcc/jumptable3.expected | 202 +++++++++--------- .../jumptable3/gcc_O2/jumptable3.expected | 134 ++++++------ .../gcc_no_plt_no_pic/jumptable3.expected | 202 +++++++++--------- .../jumptable3/gcc_pic/jumptable3.expected | 202 +++++++++--------- .../clang/malloc_with_local.expected | 122 +++++------ .../clang_O2/malloc_with_local.expected | 72 +++---- .../malloc_with_local.expected | 122 +++++------ .../clang_pic/malloc_with_local.expected | 122 +++++------ .../gcc/malloc_with_local.expected | 110 +++++----- .../gcc_O2/malloc_with_local.expected | 76 +++---- .../malloc_with_local.expected | 110 +++++----- .../gcc_pic/malloc_with_local.expected | 110 +++++----- .../clang/malloc_with_local2.expected | 132 ++++++------ .../clang_O2/malloc_with_local2.expected | 72 +++---- .../malloc_with_local2.expected | 132 ++++++------ .../clang_pic/malloc_with_local2.expected | 132 ++++++------ .../gcc/malloc_with_local2.expected | 118 +++++----- .../gcc_O2/malloc_with_local2.expected | 76 +++---- .../malloc_with_local2.expected | 118 +++++----- .../gcc_pic/malloc_with_local2.expected | 118 +++++----- .../clang/malloc_with_local3.expected | 146 ++++++------- .../clang_O2/malloc_with_local3.expected | 72 +++---- .../malloc_with_local3.expected | 146 ++++++------- .../clang_pic/malloc_with_local3.expected | 146 ++++++------- .../gcc/malloc_with_local3.expected | 132 ++++++------ .../gcc_O2/malloc_with_local3.expected | 110 +++++----- .../malloc_with_local3.expected | 132 ++++++------ .../gcc_pic/malloc_with_local3.expected | 132 ++++++------ .../multi_malloc/clang/multi_malloc.expected | 118 +++++----- .../clang_O2/multi_malloc.expected | 70 +++--- .../clang_no_plt_no_pic/multi_malloc.expected | 118 +++++----- .../clang_pic/multi_malloc.expected | 118 +++++----- .../multi_malloc/gcc/multi_malloc.expected | 106 ++++----- .../multi_malloc/gcc_O2/multi_malloc.expected | 74 +++---- .../gcc_no_plt_no_pic/multi_malloc.expected | 106 ++++----- .../gcc_pic/multi_malloc.expected | 106 ++++----- .../correct/nestedif/clang/nestedif.expected | 98 ++++----- .../nestedif/clang_O2/nestedif.expected | 24 +-- .../clang_no_plt_no_pic/nestedif.expected | 98 ++++----- .../nestedif/clang_pic/nestedif.expected | 98 ++++----- .../correct/nestedif/gcc/nestedif.expected | 82 +++---- .../correct/nestedif/gcc_O2/nestedif.expected | 24 +-- .../gcc_no_plt_no_pic/nestedif.expected | 82 +++---- .../nestedif/gcc_pic/nestedif.expected | 82 +++---- .../clang/no_interference_update_x.expected | 48 ++--- .../no_interference_update_x.expected | 48 ++--- .../no_interference_update_x.expected | 48 ++--- .../no_interference_update_x.expected | 52 ++--- .../gcc/no_interference_update_x.expected | 44 ++-- .../gcc_O2/no_interference_update_x.expected | 48 ++--- .../no_interference_update_x.expected | 44 ++-- .../gcc_pic/no_interference_update_x.expected | 48 ++--- .../clang/no_interference_update_y.expected | 48 ++--- .../no_interference_update_y.expected | 48 ++--- .../no_interference_update_y.expected | 48 ++--- .../no_interference_update_y.expected | 52 ++--- .../gcc/no_interference_update_y.expected | 44 ++-- .../gcc_O2/no_interference_update_y.expected | 48 ++--- .../no_interference_update_y.expected | 44 ++-- .../gcc_pic/no_interference_update_y.expected | 48 ++--- .../secret_write/clang/secret_write.expected | 74 +++---- .../clang_O2/secret_write.expected | 64 +++--- .../clang_no_plt_no_pic/secret_write.expected | 74 +++---- .../clang_pic/secret_write.expected | 78 +++---- .../secret_write/gcc/secret_write.expected | 66 +++--- .../secret_write/gcc_O2/secret_write.expected | 64 +++--- .../gcc_no_plt_no_pic/secret_write.expected | 66 +++--- .../gcc_pic/secret_write.expected | 70 +++--- .../simple_jump/clang/simple_jump.expected | 76 +++---- .../simple_jump/clang_O2/simple_jump.expected | 24 +-- .../clang_no_plt_no_pic/simple_jump.expected | 76 +++---- .../clang_pic/simple_jump.expected | 76 +++---- .../simple_jump/gcc/simple_jump.expected | 68 +++--- .../simple_jump/gcc_O2/simple_jump.expected | 24 +-- .../gcc_no_plt_no_pic/simple_jump.expected | 68 +++--- .../simple_jump/gcc_pic/simple_jump.expected | 68 +++--- src/test/correct/switch/clang/switch.expected | 86 ++++---- .../correct/switch/clang_O2/switch.expected | 20 +- .../clang_no_plt_no_pic/switch.expected | 86 ++++---- .../correct/switch/clang_pic/switch.expected | 86 ++++---- src/test/correct/switch/gcc/switch.expected | 80 +++---- .../correct/switch/gcc_O2/switch.expected | 20 +- .../switch/gcc_no_plt_no_pic/switch.expected | 80 +++---- .../correct/switch/gcc_pic/switch.expected | 80 +++---- .../correct/switch2/clang_O2/switch2.expected | 18 +- src/test/correct/switch2/gcc/switch2.expected | 134 ++++++------ .../correct/switch2/gcc_O2/switch2.expected | 18 +- .../gcc_no_plt_no_pic/switch2.expected | 134 ++++++------ .../correct/switch2/gcc_pic/switch2.expected | 134 ++++++------ .../correct/syscall/clang/syscall.expected | 86 ++++---- .../clang_no_plt_no_pic/syscall.expected | 86 ++++---- .../syscall/clang_pic/syscall.expected | 86 ++++---- src/test/correct/syscall/gcc/syscall.expected | 84 ++++---- .../correct/syscall/gcc_O2/syscall.expected | 26 +-- .../gcc_no_plt_no_pic/syscall.expected | 84 ++++---- .../correct/syscall/gcc_pic/syscall.expected | 84 ++++---- .../clang/using_gamma_conditional.expected | 84 ++++---- .../clang_O2/using_gamma_conditional.expected | 58 ++--- .../using_gamma_conditional.expected | 84 ++++---- .../using_gamma_conditional.expected | 88 ++++---- .../gcc/using_gamma_conditional.expected | 60 +++--- .../gcc_O2/using_gamma_conditional.expected | 54 ++--- .../using_gamma_conditional.expected | 60 +++--- .../gcc_pic/using_gamma_conditional.expected | 64 +++--- .../clang/using_gamma_write_z.expected | 50 ++--- .../clang_O2/using_gamma_write_z.expected | 50 ++--- .../using_gamma_write_z.expected | 50 ++--- .../clang_pic/using_gamma_write_z.expected | 54 ++--- .../gcc/using_gamma_write_z.expected | 46 ++-- .../gcc_O2/using_gamma_write_z.expected | 50 ++--- .../using_gamma_write_z.expected | 46 ++-- .../gcc_pic/using_gamma_write_z.expected | 50 ++--- .../basicassign/clang/basicassign.expected | 72 +++---- .../basicassign/clang_O2/basicassign.expected | 62 +++--- .../clang_no_plt_no_pic/basicassign.expected | 72 +++---- .../clang_pic/basicassign.expected | 76 +++---- .../basicassign/gcc/basicassign.expected | 60 +++--- .../basicassign/gcc_O2/basicassign.expected | 58 ++--- .../gcc_no_plt_no_pic/basicassign.expected | 60 +++--- .../basicassign/gcc_pic/basicassign.expected | 64 +++--- .../basicassign1/clang/basicassign1.expected | 68 +++--- .../clang_O2/basicassign1.expected | 48 ++--- .../clang_no_plt_no_pic/basicassign1.expected | 68 +++--- .../clang_pic/basicassign1.expected | 72 +++---- .../basicassign1/gcc/basicassign1.expected | 60 +++--- .../basicassign1/gcc_O2/basicassign1.expected | 48 ++--- .../gcc_no_plt_no_pic/basicassign1.expected | 60 +++--- .../gcc_pic/basicassign1.expected | 64 +++--- .../basicassign2/clang/basicassign2.expected | 70 +++--- .../clang_O2/basicassign2.expected | 50 ++--- .../clang_no_plt_no_pic/basicassign2.expected | 70 +++--- .../clang_pic/basicassign2.expected | 70 +++--- .../basicassign2/gcc/basicassign2.expected | 62 +++--- .../basicassign2/gcc_O2/basicassign2.expected | 50 ++--- .../gcc_no_plt_no_pic/basicassign2.expected | 62 +++--- .../gcc_pic/basicassign2.expected | 62 +++--- .../basicassign3/clang/basicassign3.expected | 70 +++--- .../clang_O2/basicassign3.expected | 50 ++--- .../clang_no_plt_no_pic/basicassign3.expected | 70 +++--- .../clang_pic/basicassign3.expected | 74 +++---- .../basicassign3/gcc/basicassign3.expected | 62 +++--- .../basicassign3/gcc_O2/basicassign3.expected | 50 ++--- .../gcc_no_plt_no_pic/basicassign3.expected | 62 +++--- .../gcc_pic/basicassign3.expected | 66 +++--- .../incorrect/iflocal/clang/iflocal.expected | 74 +++---- .../clang_no_plt_no_pic/iflocal.expected | 74 +++---- .../iflocal/clang_pic/iflocal.expected | 74 +++---- .../incorrect/iflocal/gcc/iflocal.expected | 66 +++--- .../gcc_no_plt_no_pic/iflocal.expected | 66 +++--- .../iflocal/gcc_pic/iflocal.expected | 66 +++--- .../clang/nestedifglobal.expected | 98 ++++----- .../nestedifglobal.expected | 98 ++++----- .../clang_pic/nestedifglobal.expected | 108 +++++----- .../gcc/nestedifglobal.expected | 86 ++++---- .../gcc_no_plt_no_pic/nestedifglobal.expected | 86 ++++---- .../gcc_pic/nestedifglobal.expected | 90 ++++---- 349 files changed, 12595 insertions(+), 12595 deletions(-) diff --git a/src/test/correct/arrays_simple/clang/arrays_simple.expected b/src/test/correct/arrays_simple/clang/arrays_simple.expected index aece6f15e..cdbb1ceb9 100644 --- a/src/test/correct/arrays_simple/clang/arrays_simple.expected +++ b/src/test/correct/arrays_simple/clang/arrays_simple.expected @@ -1,38 +1,38 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1872bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1872bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,9 +82,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -181,17 +181,17 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R8); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%0000089b"} true; R8, Gamma_R8 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000008a8"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%000008b7"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/arrays_simple/clang_O2/arrays_simple.expected b/src/test/correct/arrays_simple/clang_O2/arrays_simple.expected index 863d7bd46..dfc8a4e7d 100644 --- a/src/test/correct/arrays_simple/clang_O2/arrays_simple.expected +++ b/src/test/correct/arrays_simple/clang_O2/arrays_simple.expected @@ -1,14 +1,14 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1840bv64); -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1840bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/arrays_simple/clang_no_plt_no_pic/arrays_simple.expected b/src/test/correct/arrays_simple/clang_no_plt_no_pic/arrays_simple.expected index aece6f15e..cdbb1ceb9 100644 --- a/src/test/correct/arrays_simple/clang_no_plt_no_pic/arrays_simple.expected +++ b/src/test/correct/arrays_simple/clang_no_plt_no_pic/arrays_simple.expected @@ -1,38 +1,38 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1872bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1872bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,9 +82,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -181,17 +181,17 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R8); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%0000089b"} true; R8, Gamma_R8 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000008a8"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%000008b7"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/arrays_simple/clang_pic/arrays_simple.expected b/src/test/correct/arrays_simple/clang_pic/arrays_simple.expected index aece6f15e..cdbb1ceb9 100644 --- a/src/test/correct/arrays_simple/clang_pic/arrays_simple.expected +++ b/src/test/correct/arrays_simple/clang_pic/arrays_simple.expected @@ -1,38 +1,38 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1872bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1872bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,9 +82,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -181,17 +181,17 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R8); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%0000089b"} true; R8, Gamma_R8 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000008a8"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%000008b7"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/arrays_simple/gcc_O2/arrays_simple.expected b/src/test/correct/arrays_simple/gcc_O2/arrays_simple.expected index 418f9a5da..db578d839 100644 --- a/src/test/correct/arrays_simple/gcc_O2/arrays_simple.expected +++ b/src/test/correct/arrays_simple/gcc_O2/arrays_simple.expected @@ -1,14 +1,14 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1896bv64); -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1896bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_arrays_read/clang/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/clang/basic_arrays_read.expected index 89944a5ec..51a10f3b8 100644 --- a/src/test/correct/basic_arrays_read/clang/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/clang/basic_arrays_read.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$arr_addr: bv64; -axiom {:extern }($arr_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom ($arr_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -77,7 +77,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -85,12 +85,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert true; @@ -190,16 +190,16 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000002d1"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> true); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), true); assert true; - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002dd"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; diff --git a/src/test/correct/basic_arrays_read/clang_O2/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/clang_O2/basic_arrays_read.expected index 62beee9a8..efc782dbb 100644 --- a/src/test/correct/basic_arrays_read/clang_O2/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/clang_O2/basic_arrays_read.expected @@ -1,33 +1,33 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$arr_addr: bv64; -axiom {:extern }($arr_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom ($arr_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -68,7 +68,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -76,12 +76,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert true; @@ -179,13 +179,13 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> true); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), true); assert true; - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000002c9"} true; return; } diff --git a/src/test/correct/basic_arrays_read/clang_no_plt_no_pic/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/clang_no_plt_no_pic/basic_arrays_read.expected index 89944a5ec..9677616ad 100644 --- a/src/test/correct/basic_arrays_read/clang_no_plt_no_pic/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/clang_no_plt_no_pic/basic_arrays_read.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$arr_addr: bv64; -axiom {:extern }($arr_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom ($arr_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -77,7 +77,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -85,12 +85,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert true; @@ -190,16 +190,16 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000863"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> true); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), true); assert true; - assume {:captureState "addr:0x720"}true; + assume {:captureState "%0000086f"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; diff --git a/src/test/correct/basic_arrays_read/clang_pic/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/clang_pic/basic_arrays_read.expected index e16692dc4..119db2945 100644 --- a/src/test/correct/basic_arrays_read/clang_pic/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/clang_pic/basic_arrays_read.expected @@ -1,50 +1,50 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$arr_addr: bv64; -axiom {:extern }($arr_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom ($arr_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -93,7 +93,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -101,12 +101,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert true; @@ -222,10 +222,10 @@ procedure main() free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%000002d5"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4056bv64)) || L(mem, bvadd64(R8, 4056bv64))); @@ -233,7 +233,7 @@ procedure main() assert (L(mem, R8) ==> true); mem, Gamma_mem := memory_store32_le(mem, R8, 0bv32), gamma_store32(Gamma_mem, R8, true); assert true; - assume {:captureState "addr:0x764"}true; + assume {:captureState "%000002e8"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; diff --git a/src/test/correct/basic_arrays_read/gcc/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/gcc/basic_arrays_read.expected index cf4f9458e..aa2899d20 100644 --- a/src/test/correct/basic_arrays_read/gcc/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/gcc/basic_arrays_read.expected @@ -1,36 +1,36 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$arr_addr: bv64; -axiom {:extern }($arr_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom ($arr_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -71,7 +71,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -79,12 +79,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert true; @@ -182,14 +182,14 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); assert (L(mem, R0) ==> true); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert true; - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000002d6"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); diff --git a/src/test/correct/basic_arrays_read/gcc_O2/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/gcc_O2/basic_arrays_read.expected index 697310dfc..8b51616b4 100644 --- a/src/test/correct/basic_arrays_read/gcc_O2/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/gcc_O2/basic_arrays_read.expected @@ -1,33 +1,33 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$arr_addr: bv64; -axiom {:extern }($arr_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom ($arr_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -68,7 +68,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -76,12 +76,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert true; @@ -179,13 +179,13 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R1, 24bv64)) ==> true); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 24bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R1, 24bv64), true); assert true; - assume {:captureState "addr:0x608"}true; + assume {:captureState "%000001b7"} true; return; } diff --git a/src/test/correct/basic_arrays_read/gcc_no_plt_no_pic/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/gcc_no_plt_no_pic/basic_arrays_read.expected index cf4f9458e..e14123c99 100644 --- a/src/test/correct/basic_arrays_read/gcc_no_plt_no_pic/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/gcc_no_plt_no_pic/basic_arrays_read.expected @@ -1,36 +1,36 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$arr_addr: bv64; -axiom {:extern }($arr_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom ($arr_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -71,7 +71,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -79,12 +79,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert true; @@ -182,14 +182,14 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); assert (L(mem, R0) ==> true); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert true; - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000866"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); diff --git a/src/test/correct/basic_arrays_read/gcc_pic/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/gcc_pic/basic_arrays_read.expected index 583888bee..4ce3ddd81 100644 --- a/src/test/correct/basic_arrays_read/gcc_pic/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/gcc_pic/basic_arrays_read.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$arr_addr: bv64; -axiom {:extern }($arr_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom ($arr_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -87,7 +87,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -95,12 +95,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert true; @@ -214,7 +214,7 @@ procedure main() free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4080bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4080bv64)) || L(mem, bvadd64(R0, 4080bv64))); @@ -222,7 +222,7 @@ procedure main() assert (L(mem, R0) ==> true); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert true; - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%000002d7"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4080bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4080bv64)) || L(mem, bvadd64(R0, 4080bv64))); diff --git a/src/test/correct/basic_arrays_write/clang/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/clang/basic_arrays_write.expected index f8f5ec6b5..fa1ca5a2b 100644 --- a/src/test/correct/basic_arrays_write/clang/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/clang/basic_arrays_write.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$arr_addr: bv64; -axiom {:extern }($arr_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom ($arr_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -87,12 +87,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert true; } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -194,19 +194,19 @@ procedure main() { var arr$0_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R9, Gamma_R9 := 69632bv64, true; R9, Gamma_R9 := bvadd64(R9, 52bv64), Gamma_R9; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002e5"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, bvadd64(R9, 4bv64)) ==> Gamma_R8); arr$0_old := memory_load32_le(mem, bvadd64($arr_addr, 0bv64)); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 4bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 4bv64), Gamma_R8); assert (arr$0_old == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%000002f4"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_arrays_write/clang_O2/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/clang_O2/basic_arrays_write.expected index d809dcc3f..e22e851bb 100644 --- a/src/test/correct/basic_arrays_write/clang_O2/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/clang_O2/basic_arrays_write.expected @@ -1,36 +1,36 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$arr_addr: bv64; -axiom {:extern }($arr_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom ($arr_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -71,7 +71,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -79,12 +79,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert true; } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -184,7 +184,7 @@ procedure main() { var arr$0_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -193,6 +193,6 @@ procedure main() arr$0_old := memory_load32_le(mem, bvadd64($arr_addr, 0bv64)); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); assert (arr$0_old == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002d4"} true; return; } diff --git a/src/test/correct/basic_arrays_write/clang_no_plt_no_pic/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/clang_no_plt_no_pic/basic_arrays_write.expected index f8f5ec6b5..6f9a27b7f 100644 --- a/src/test/correct/basic_arrays_write/clang_no_plt_no_pic/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/clang_no_plt_no_pic/basic_arrays_write.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$arr_addr: bv64; -axiom {:extern }($arr_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom ($arr_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -87,12 +87,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert true; } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -194,19 +194,19 @@ procedure main() { var arr$0_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R9, Gamma_R9 := 69632bv64, true; R9, Gamma_R9 := bvadd64(R9, 52bv64), Gamma_R9; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000890"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, bvadd64(R9, 4bv64)) ==> Gamma_R8); arr$0_old := memory_load32_le(mem, bvadd64($arr_addr, 0bv64)); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 4bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 4bv64), Gamma_R8); assert (arr$0_old == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%0000089f"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_arrays_write/clang_pic/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/clang_pic/basic_arrays_write.expected index 026bdc6e2..5f24ac94c 100644 --- a/src/test/correct/basic_arrays_write/clang_pic/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/clang_pic/basic_arrays_write.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$arr_addr: bv64; -axiom {:extern }($arr_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom ($arr_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -95,7 +95,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -103,12 +103,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert true; } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -226,20 +226,20 @@ procedure main() { var arr$0_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4056bv64)) || L(mem, bvadd64(R9, 4056bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000002e6"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, bvadd64(R9, 4bv64)) ==> Gamma_R8); arr$0_old := memory_load32_le(mem, bvadd64($arr_addr, 0bv64)); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 4bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 4bv64), Gamma_R8); assert (arr$0_old == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%000002f5"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_arrays_write/gcc/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/gcc/basic_arrays_write.expected index 75be2e279..842329e9c 100644 --- a/src/test/correct/basic_arrays_write/gcc/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/gcc/basic_arrays_write.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$arr_addr: bv64; -axiom {:extern }($arr_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom ($arr_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -77,7 +77,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -85,12 +85,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert true; } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -192,10 +192,10 @@ procedure main() { var arr$0_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000002da"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); @@ -204,7 +204,7 @@ procedure main() arr$0_old := memory_load32_le(mem, bvadd64($arr_addr, 0bv64)); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R0, 4bv64), R1[32:0]), gamma_store32(Gamma_mem, bvadd64(R0, 4bv64), Gamma_R1); assert (arr$0_old == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%000002f4"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_arrays_write/gcc_O2/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/gcc_O2/basic_arrays_write.expected index 185310dc9..1d10bd0a8 100644 --- a/src/test/correct/basic_arrays_write/gcc_O2/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/gcc_O2/basic_arrays_write.expected @@ -1,36 +1,36 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$arr_addr: bv64; -axiom {:extern }($arr_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom ($arr_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -71,7 +71,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -79,12 +79,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert true; } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -184,7 +184,7 @@ procedure main() { var arr$0_old: bv32; lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 0bv64, true; @@ -193,6 +193,6 @@ procedure main() arr$0_old := memory_load32_le(mem, bvadd64($arr_addr, 0bv64)); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 28bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 28bv64), Gamma_R2); assert (arr$0_old == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); - assume {:captureState "addr:0x60c"}true; + assume {:captureState "%000001be"} true; return; } diff --git a/src/test/correct/basic_arrays_write/gcc_no_plt_no_pic/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/gcc_no_plt_no_pic/basic_arrays_write.expected index 75be2e279..dfc86a463 100644 --- a/src/test/correct/basic_arrays_write/gcc_no_plt_no_pic/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/gcc_no_plt_no_pic/basic_arrays_write.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$arr_addr: bv64; -axiom {:extern }($arr_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom ($arr_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -77,7 +77,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -85,12 +85,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert true; } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -192,10 +192,10 @@ procedure main() { var arr$0_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000885"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); @@ -204,7 +204,7 @@ procedure main() arr$0_old := memory_load32_le(mem, bvadd64($arr_addr, 0bv64)); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R0, 4bv64), R1[32:0]), gamma_store32(Gamma_mem, bvadd64(R0, 4bv64), Gamma_R1); assert (arr$0_old == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%0000089f"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_arrays_write/gcc_pic/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/gcc_pic/basic_arrays_write.expected index b86cc5bfe..f0df48118 100644 --- a/src/test/correct/basic_arrays_write/gcc_pic/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/gcc_pic/basic_arrays_write.expected @@ -1,50 +1,50 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$arr_addr: bv64; -axiom {:extern }($arr_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $arr_addr: bv64; +axiom ($arr_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -93,7 +93,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -101,12 +101,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert true; } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -224,10 +224,10 @@ procedure main() { var arr$0_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%000002da"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4080bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4080bv64)) || L(mem, bvadd64(R0, 4080bv64))); @@ -237,7 +237,7 @@ procedure main() arr$0_old := memory_load32_le(mem, bvadd64($arr_addr, 0bv64)); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R0, 4bv64), R1[32:0]), gamma_store32(Gamma_mem, bvadd64(R0, 4bv64), Gamma_R1); assert (arr$0_old == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%000002f5"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_assign_assign/clang/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/clang/basic_assign_assign.expected index 79f7e8bea..9c8f8e054 100644 --- a/src/test/correct/basic_assign_assign/clang/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/clang/basic_assign_assign.expected @@ -1,35 +1,35 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -70,7 +70,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -78,12 +78,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -184,7 +184,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 5bv64, true; call rely(); @@ -192,7 +192,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 5bv32)); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000002ce"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_assign/clang_O2/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/clang_O2/basic_assign_assign.expected index 9077f5b9d..e95a25ce5 100644 --- a/src/test/correct/basic_assign_assign/clang_O2/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/clang_O2/basic_assign_assign.expected @@ -1,35 +1,35 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -70,7 +70,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -78,12 +78,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -184,7 +184,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 5bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -193,6 +193,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); assert ((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 5bv32)); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002d3"} true; return; } diff --git a/src/test/correct/basic_assign_assign/clang_no_plt_no_pic/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/clang_no_plt_no_pic/basic_assign_assign.expected index 79f7e8bea..b64e6256d 100644 --- a/src/test/correct/basic_assign_assign/clang_no_plt_no_pic/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/clang_no_plt_no_pic/basic_assign_assign.expected @@ -1,35 +1,35 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -70,7 +70,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -78,12 +78,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -184,7 +184,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 5bv64, true; call rely(); @@ -192,7 +192,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 5bv32)); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000845"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_assign/clang_pic/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/clang_pic/basic_assign_assign.expected index a79f954f2..9adc4bc36 100644 --- a/src/test/correct/basic_assign_assign/clang_pic/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/clang_pic/basic_assign_assign.expected @@ -1,43 +1,43 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -86,7 +86,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -94,12 +94,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -216,7 +216,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); @@ -226,7 +226,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert ((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 5bv32)); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000002d9"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_assign/gcc/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/gcc/basic_assign_assign.expected index 493399a9b..38fd4e9ff 100644 --- a/src/test/correct/basic_assign_assign/gcc/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/gcc/basic_assign_assign.expected @@ -1,33 +1,33 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -68,7 +68,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -76,12 +76,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -182,7 +182,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 5bv64, true; @@ -191,7 +191,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 5bv32)); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002d8"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_assign/gcc_O2/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/gcc_O2/basic_assign_assign.expected index 8c5ad69c8..55dc84373 100644 --- a/src/test/correct/basic_assign_assign/gcc_O2/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/gcc_O2/basic_assign_assign.expected @@ -1,35 +1,35 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -70,7 +70,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -78,12 +78,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -184,7 +184,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 5bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -193,6 +193,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R2); assert ((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 5bv32)); - assume {:captureState "addr:0x60c"}true; + assume {:captureState "%000001bd"} true; return; } diff --git a/src/test/correct/basic_assign_assign/gcc_no_plt_no_pic/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/gcc_no_plt_no_pic/basic_assign_assign.expected index 493399a9b..60efa0cb5 100644 --- a/src/test/correct/basic_assign_assign/gcc_no_plt_no_pic/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/gcc_no_plt_no_pic/basic_assign_assign.expected @@ -1,33 +1,33 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -68,7 +68,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -76,12 +76,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -182,7 +182,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 5bv64, true; @@ -191,7 +191,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 5bv32)); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%0000085b"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_assign/gcc_pic/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/gcc_pic/basic_assign_assign.expected index 9df5b4933..2e59e747e 100644 --- a/src/test/correct/basic_assign_assign/gcc_pic/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/gcc_pic/basic_assign_assign.expected @@ -1,41 +1,41 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -84,7 +84,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -92,12 +92,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -214,7 +214,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -224,7 +224,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 5bv32)); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000002d9"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_increment/clang/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/clang/basic_assign_increment.expected index eb5c00566..aad1b3b63 100644 --- a/src/test/correct/basic_assign_increment/clang/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/clang/basic_assign_increment.expected @@ -1,41 +1,41 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -76,7 +76,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -84,12 +84,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -190,7 +190,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R9, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R9, 52bv64)) || L(mem, bvadd64(R9, 52bv64))); @@ -200,7 +200,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert (((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002da"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_increment/clang_O2/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/clang_O2/basic_assign_increment.expected index 05ad161e1..f1e4916f6 100644 --- a/src/test/correct/basic_assign_increment/clang_O2/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/clang_O2/basic_assign_increment.expected @@ -1,41 +1,41 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -76,7 +76,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -84,12 +84,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -190,7 +190,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); @@ -201,6 +201,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); assert (((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000002df"} true; return; } diff --git a/src/test/correct/basic_assign_increment/clang_no_plt_no_pic/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/clang_no_plt_no_pic/basic_assign_increment.expected index eb5c00566..5b8b8cf93 100644 --- a/src/test/correct/basic_assign_increment/clang_no_plt_no_pic/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/clang_no_plt_no_pic/basic_assign_increment.expected @@ -1,41 +1,41 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -76,7 +76,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -84,12 +84,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -190,7 +190,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R9, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R9, 52bv64)) || L(mem, bvadd64(R9, 52bv64))); @@ -200,7 +200,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert (((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%0000085f"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_increment/clang_pic/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/clang_pic/basic_assign_increment.expected index 1c3b1ec98..c37e6ca48 100644 --- a/src/test/correct/basic_assign_increment/clang_pic/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/clang_pic/basic_assign_increment.expected @@ -1,49 +1,49 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -92,7 +92,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -100,12 +100,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -222,7 +222,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); @@ -234,7 +234,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert (((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%000002e5"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_increment/gcc/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/gcc/basic_assign_increment.expected index 60a051dbc..c5b62995a 100644 --- a/src/test/correct/basic_assign_increment/gcc/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/gcc/basic_assign_increment.expected @@ -1,39 +1,39 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -74,7 +74,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -82,12 +82,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -188,7 +188,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -201,7 +201,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%000002f7"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_increment/gcc_O2/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/gcc_O2/basic_assign_increment.expected index d839cbae8..7ae4e3385 100644 --- a/src/test/correct/basic_assign_increment/gcc_O2/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/gcc_O2/basic_assign_increment.expected @@ -1,41 +1,41 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -76,7 +76,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -84,12 +84,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -190,7 +190,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R2, Gamma_R2 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); @@ -201,6 +201,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R2, 20bv64), R1[32:0]), gamma_store32(Gamma_mem, bvadd64(R2, 20bv64), Gamma_R1); assert (((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); - assume {:captureState "addr:0x610"}true; + assume {:captureState "%000001c5"} true; return; } diff --git a/src/test/correct/basic_assign_increment/gcc_no_plt_no_pic/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/gcc_no_plt_no_pic/basic_assign_increment.expected index 60a051dbc..56bb581a8 100644 --- a/src/test/correct/basic_assign_increment/gcc_no_plt_no_pic/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/gcc_no_plt_no_pic/basic_assign_increment.expected @@ -1,39 +1,39 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -74,7 +74,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -82,12 +82,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -188,7 +188,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -201,7 +201,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%0000089f"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_assign_increment/gcc_pic/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/gcc_pic/basic_assign_increment.expected index c47643c28..1b021ed21 100644 --- a/src/test/correct/basic_assign_increment/gcc_pic/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/gcc_pic/basic_assign_increment.expected @@ -1,47 +1,47 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -90,7 +90,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -98,12 +98,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -220,7 +220,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -235,7 +235,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (((memory_load32_le(mem, $x_addr) == x_old) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); - assume {:captureState "addr:0x76c"}true; + assume {:captureState "%000002f9"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_caller/clang/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/clang/basic_function_call_caller.expected index a10273415..c07d90bb6 100644 --- a/src/test/correct/basic_function_call_caller/clang/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/clang/basic_function_call_caller.expected @@ -1,66 +1,66 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -102,7 +102,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -111,13 +111,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -227,21 +227,21 @@ procedure main() var Gamma_y_old: bool; var x_old: bv32; lmain: - assume {:captureState "addr:0x71c"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000304"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%0000030a"} true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R0); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000318"} true; R30, Gamma_R30 := 1840bv64, true; call zero(); goto l00000321; l00000321: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l00000321"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R0); @@ -251,7 +251,7 @@ procedure main() assert ((bvadd64(R8, 52bv64) == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%0000032c"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R29, 18446744073709551612bv64))), gamma_load32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); @@ -262,7 +262,7 @@ procedure main() assert ((bvadd64(R9, 56bv64) == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000340"} true; R0, Gamma_R0 := 0bv64, true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -348,7 +348,7 @@ procedure zero() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lzero: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lzero"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_caller/clang_O2/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/clang_O2/basic_function_call_caller.expected index 5fbc30ede..092049e86 100644 --- a/src/test/correct/basic_function_call_caller/clang_O2/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/clang_O2/basic_function_call_caller.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -80,7 +80,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -89,13 +89,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -197,7 +197,7 @@ procedure main() var Gamma_y_old: bool; var x_old: bv32; lmain: - assume {:captureState "addr:0x71c"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 0bv64, true; R9, Gamma_R9 := 69632bv64, true; @@ -210,7 +210,7 @@ procedure main() assert ((bvadd64(R9, 52bv64) == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%000002f2"} true; call rely(); assert (L(mem, bvadd64(R10, 56bv64)) ==> Gamma_R8); x_old := memory_load32_le(mem, $x_addr); @@ -219,6 +219,6 @@ procedure main() assert ((bvadd64(R10, 56bv64) == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); - assume {:captureState "addr:0x730"}true; + assume {:captureState "%000002fa"} true; return; } diff --git a/src/test/correct/basic_function_call_caller/clang_no_plt_no_pic/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/clang_no_plt_no_pic/basic_function_call_caller.expected index 7ef9fd5f4..22ee5ada7 100644 --- a/src/test/correct/basic_function_call_caller/clang_no_plt_no_pic/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/clang_no_plt_no_pic/basic_function_call_caller.expected @@ -1,66 +1,66 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -102,7 +102,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -111,13 +111,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -227,21 +227,21 @@ procedure main() var Gamma_y_old: bool; var x_old: bv32; lmain: - assume {:captureState "addr:0x71c"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%0000091b"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000921"} true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R0); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%0000092f"} true; R30, Gamma_R30 := 1840bv64, true; call zero(); goto l00000938; l00000938: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l00000938"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R0); @@ -251,7 +251,7 @@ procedure main() assert ((bvadd64(R8, 52bv64) == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%00000943"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R29, 18446744073709551612bv64))), gamma_load32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); @@ -262,7 +262,7 @@ procedure main() assert ((bvadd64(R9, 56bv64) == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000957"} true; R0, Gamma_R0 := 0bv64, true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -348,7 +348,7 @@ procedure zero() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lzero: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lzero"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_caller/clang_pic/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/clang_pic/basic_function_call_caller.expected index 44c1da5db..4b7a73526 100644 --- a/src/test/correct/basic_function_call_caller/clang_pic/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/clang_pic/basic_function_call_caller.expected @@ -1,66 +1,66 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -118,7 +118,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -127,13 +127,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -275,21 +275,21 @@ procedure main() var Gamma_y_old: bool; var x_old: bv32; lmain: - assume {:captureState "addr:0x75c"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%0000030c"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%00000312"} true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R0); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%00000320"} true; R30, Gamma_R30 := 1904bv64, true; call zero(); goto l00000329; l00000329: - assume {:captureState "addr:0x770"}true; + assume {:captureState "addr:l00000329"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -301,7 +301,7 @@ procedure main() assert ((R8 == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%0000033b"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R29, 18446744073709551612bv64))), gamma_load32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64)); R9, Gamma_R9 := 65536bv64, true; call rely(); @@ -314,7 +314,7 @@ procedure main() assert ((R9 == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); - assume {:captureState "addr:0x788"}true; + assume {:captureState "%00000356"} true; R0, Gamma_R0 := 0bv64, true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -432,7 +432,7 @@ procedure zero() free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { lzero: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lzero"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_caller/gcc/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/gcc/basic_function_call_caller.expected index 7fc5cb92b..ffb17ca5f 100644 --- a/src/test/correct/basic_function_call_caller/gcc/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/gcc/basic_function_call_caller.expected @@ -1,64 +1,64 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -100,7 +100,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -109,13 +109,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -223,21 +223,21 @@ procedure main() var Gamma_y_old: bool; var x_old: bv32; lmain: - assume {:captureState "addr:0x71c"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000302"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000308"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%0000031a"} true; R30, Gamma_R30 := 1836bv64, true; call zero(); goto l00000323; l00000323: - assume {:captureState "addr:0x72c"}true; + assume {:captureState "addr:l00000323"} true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; @@ -249,7 +249,7 @@ procedure main() assert ((R0 == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%0000033a"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); @@ -261,7 +261,7 @@ procedure main() assert ((R0 == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000354"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -346,7 +346,7 @@ procedure zero() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lzero: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lzero"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_caller/gcc_O2/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/gcc_O2/basic_function_call_caller.expected index d381cc1fc..b7a8e4c30 100644 --- a/src/test/correct/basic_function_call_caller/gcc_O2/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/gcc_O2/basic_function_call_caller.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R3: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }R3: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R3: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R3: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -80,7 +80,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -89,13 +89,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -197,7 +197,7 @@ procedure main() var Gamma_y_old: bool; var x_old: bv32; lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R3, Gamma_R3 := zero_extend32_32(R0[32:0]), Gamma_R0; @@ -210,7 +210,7 @@ procedure main() assert ((bvadd64(R1, 20bv64) == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); - assume {:captureState "addr:0x610"}true; + assume {:captureState "%000001d7"} true; call rely(); assert (L(mem, bvadd64(R2, 4bv64)) ==> Gamma_R3); x_old := memory_load32_le(mem, $x_addr); @@ -219,6 +219,6 @@ procedure main() assert ((bvadd64(R2, 4bv64) == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); - assume {:captureState "addr:0x614"}true; + assume {:captureState "%000001df"} true; return; } diff --git a/src/test/correct/basic_function_call_caller/gcc_no_plt_no_pic/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/gcc_no_plt_no_pic/basic_function_call_caller.expected index 679815f97..9549d6dff 100644 --- a/src/test/correct/basic_function_call_caller/gcc_no_plt_no_pic/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/gcc_no_plt_no_pic/basic_function_call_caller.expected @@ -1,64 +1,64 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -100,7 +100,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -109,13 +109,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -223,21 +223,21 @@ procedure main() var Gamma_y_old: bool; var x_old: bv32; lmain: - assume {:captureState "addr:0x71c"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000929"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%0000092f"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000941"} true; R30, Gamma_R30 := 1836bv64, true; call zero(); goto l0000094a; l0000094a: - assume {:captureState "addr:0x72c"}true; + assume {:captureState "addr:l0000094a"} true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; @@ -249,7 +249,7 @@ procedure main() assert ((R0 == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%00000961"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); @@ -261,7 +261,7 @@ procedure main() assert ((R0 == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%0000097b"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -346,7 +346,7 @@ procedure zero() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lzero: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lzero"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_caller/gcc_pic/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/gcc_pic/basic_function_call_caller.expected index af7d75a4b..914d32dd1 100644 --- a/src/test/correct/basic_function_call_caller/gcc_pic/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/gcc_pic/basic_function_call_caller.expected @@ -1,64 +1,64 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -116,7 +116,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -125,13 +125,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -271,21 +271,21 @@ procedure main() var Gamma_y_old: bool; var x_old: bv32; lmain: - assume {:captureState "addr:0x75c"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%00000302"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%00000308"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%0000031a"} true; R30, Gamma_R30 := 1900bv64, true; call zero(); goto l00000323; l00000323: - assume {:captureState "addr:0x76c"}true; + assume {:captureState "addr:l00000323"} true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -298,7 +298,7 @@ procedure main() assert ((R0 == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%0000033b"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -311,7 +311,7 @@ procedure main() assert ((R0 == $x_addr) ==> (L(mem, $y_addr) ==> Gamma_y_old)); assert ((x_old == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (Gamma_y_old ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); - assume {:captureState "addr:0x788"}true; + assume {:captureState "%00000356"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -428,7 +428,7 @@ procedure zero() free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { lzero: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lzero"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_reader/clang/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/clang/basic_function_call_reader.expected index 682ce7324..a56d3accc 100644 --- a/src/test/correct/basic_function_call_reader/clang/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/clang/basic_function_call_reader.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -88,7 +88,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -97,13 +97,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -214,15 +214,15 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000301"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000315"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); @@ -250,21 +250,21 @@ procedure main() } goto l0000037a; l00000350: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000350"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x74c"}true; + assume {:captureState "%00000362"} true; goto l00000365; l0000037a: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l0000037a"} true; goto l0000037b; l0000037b: - assume {:captureState "addr:0x740"}true; + assume {:captureState "addr:l0000037b"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000383"} true; goto l00000365; l00000365: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:l00000365"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_function_call_reader/clang_O2/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/clang_O2/basic_function_call_reader.expected index 2529e078a..201254189 100644 --- a/src/test/correct/basic_function_call_reader/clang_O2/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/clang_O2/basic_function_call_reader.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -78,7 +78,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -87,13 +87,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -202,7 +202,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); diff --git a/src/test/correct/basic_function_call_reader/clang_no_plt_no_pic/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/clang_no_plt_no_pic/basic_function_call_reader.expected index 6466cd9a6..ea1b0d5bb 100644 --- a/src/test/correct/basic_function_call_reader/clang_no_plt_no_pic/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/clang_no_plt_no_pic/basic_function_call_reader.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -88,7 +88,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -97,13 +97,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -214,15 +214,15 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000944"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000958"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); @@ -250,21 +250,21 @@ procedure main() } goto l000009bd; l00000993: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000993"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x74c"}true; + assume {:captureState "%000009a5"} true; goto l000009a8; l000009bd: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l000009bd"} true; goto l000009be; l000009be: - assume {:captureState "addr:0x740"}true; + assume {:captureState "addr:l000009be"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%000009c6"} true; goto l000009a8; l000009a8: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:l000009a8"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_function_call_reader/clang_pic/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/clang_pic/basic_function_call_reader.expected index edf97b8b3..23c1b1cd6 100644 --- a/src/test/correct/basic_function_call_reader/clang_pic/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/clang_pic/basic_function_call_reader.expected @@ -1,60 +1,60 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -112,7 +112,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -121,13 +121,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -270,17 +270,17 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000309"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4048bv64)) || L(mem, bvadd64(R8, 4048bv64))); call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%00000324"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -310,21 +310,21 @@ procedure main() } goto l00000390; l00000366: - assume {:captureState "addr:0x790"}true; + assume {:captureState "addr:l00000366"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x794"}true; + assume {:captureState "%00000378"} true; goto l0000037b; l00000390: - assume {:captureState "addr:0x784"}true; + assume {:captureState "addr:l00000390"} true; goto l00000391; l00000391: - assume {:captureState "addr:0x788"}true; + assume {:captureState "addr:l00000391"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x788"}true; + assume {:captureState "%00000399"} true; goto l0000037b; l0000037b: - assume {:captureState "addr:0x79c"}true; + assume {:captureState "addr:l0000037b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_function_call_reader/gcc/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/gcc/basic_function_call_reader.expected index ff841269b..3d639e3be 100644 --- a/src/test/correct/basic_function_call_reader/gcc/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/gcc/basic_function_call_reader.expected @@ -1,50 +1,50 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -86,7 +86,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -95,13 +95,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -212,14 +212,14 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000304"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -235,15 +235,15 @@ procedure main() } goto l00000349; l00000332: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:l00000332"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); goto l0000033e; l00000349: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000349"} true; R0, Gamma_R0 := 0bv64, true; goto l0000033e; l0000033e: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l0000033e"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_function_call_reader/gcc_O2/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/gcc_O2/basic_function_call_reader.expected index e872eb01d..5790272c3 100644 --- a/src/test/correct/basic_function_call_reader/gcc_O2/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/gcc_O2/basic_function_call_reader.expected @@ -1,33 +1,33 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -69,7 +69,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -78,13 +78,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -183,7 +183,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -194,11 +194,11 @@ procedure main() } goto l00000398; l00000398: - assume {:captureState "addr:0x610"}true; + assume {:captureState "addr:l00000398"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 4bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 4bv64)) || L(mem, bvadd64(R1, 4bv64))); goto l000001bc; l000001bc: - assume {:captureState "addr:0x614"}true; + assume {:captureState "addr:l000001bc"} true; return; } diff --git a/src/test/correct/basic_function_call_reader/gcc_no_plt_no_pic/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/gcc_no_plt_no_pic/basic_function_call_reader.expected index 52411ea30..2a379e808 100644 --- a/src/test/correct/basic_function_call_reader/gcc_no_plt_no_pic/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/gcc_no_plt_no_pic/basic_function_call_reader.expected @@ -1,50 +1,50 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -86,7 +86,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -95,13 +95,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -212,14 +212,14 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000909"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -235,15 +235,15 @@ procedure main() } goto l0000094e; l00000937: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:l00000937"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); goto l00000943; l0000094e: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l0000094e"} true; R0, Gamma_R0 := 0bv64, true; goto l00000943; l00000943: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000943"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_function_call_reader/gcc_pic/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/gcc_pic/basic_function_call_reader.expected index 09c74a7fb..23d468816 100644 --- a/src/test/correct/basic_function_call_reader/gcc_pic/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/gcc_pic/basic_function_call_reader.expected @@ -1,58 +1,58 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -110,7 +110,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -119,13 +119,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -268,7 +268,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -276,7 +276,7 @@ procedure main() call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%00000305"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -293,15 +293,15 @@ procedure main() } goto l0000034b; l00000334: - assume {:captureState "addr:0x784"}true; + assume {:captureState "addr:l00000334"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); goto l00000340; l0000034b: - assume {:captureState "addr:0x77c"}true; + assume {:captureState "addr:l0000034b"} true; R0, Gamma_R0 := 0bv64, true; goto l00000340; l00000340: - assume {:captureState "addr:0x788"}true; + assume {:captureState "addr:l00000340"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_lock_read/clang/basic_lock_read.expected b/src/test/correct/basic_lock_read/clang/basic_lock_read.expected index 22fd43f64..30cd1ee30 100644 --- a/src/test/correct/basic_lock_read/clang/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/clang/basic_lock_read.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -87,7 +87,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -95,12 +95,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -212,12 +212,12 @@ procedure main() var ZF: bv1; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000002f9"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000300"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -245,24 +245,24 @@ procedure main() } goto l00000352; l00000352: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l00000352"} true; goto l00000353; l00000353: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l00000353"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); assert (memory_load32_le(mem, $z_addr) == z_old); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%00000360"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x744"}true; + assume {:captureState "%0000036f"} true; goto l0000033b; l0000033b: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:l0000033b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_read/clang_O2/basic_lock_read.expected b/src/test/correct/basic_lock_read/clang_O2/basic_lock_read.expected index 1e52ae958..6346d7bd6 100644 --- a/src/test/correct/basic_lock_read/clang_O2/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/clang_O2/basic_lock_read.expected @@ -1,41 +1,41 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -76,7 +76,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -84,12 +84,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -189,7 +189,7 @@ procedure main() { var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -199,18 +199,18 @@ procedure main() } goto l000002f7; l000002dc: - assume {:captureState "addr:0x728"}true; + assume {:captureState "addr:l000002dc"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); assert (memory_load32_le(mem, $z_addr) == z_old); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%000002eb"} true; R0, Gamma_R0 := 0bv64, true; return; l000002f7: - assume {:captureState "addr:0x720"}true; + assume {:captureState "addr:l000002f7"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_lock_read/clang_no_plt_no_pic/basic_lock_read.expected b/src/test/correct/basic_lock_read/clang_no_plt_no_pic/basic_lock_read.expected index 1aa1173c4..ce75ac8f3 100644 --- a/src/test/correct/basic_lock_read/clang_no_plt_no_pic/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/clang_no_plt_no_pic/basic_lock_read.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -87,7 +87,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -95,12 +95,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -212,12 +212,12 @@ procedure main() var ZF: bv1; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000924"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%0000092b"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -245,24 +245,24 @@ procedure main() } goto l0000097d; l0000097d: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l0000097d"} true; goto l0000097e; l0000097e: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l0000097e"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); assert (memory_load32_le(mem, $z_addr) == z_old); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%0000098b"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x744"}true; + assume {:captureState "%0000099a"} true; goto l00000966; l00000966: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:l00000966"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_read/clang_pic/basic_lock_read.expected b/src/test/correct/basic_lock_read/clang_pic/basic_lock_read.expected index 850826886..497ebae33 100644 --- a/src/test/correct/basic_lock_read/clang_pic/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/clang_pic/basic_lock_read.expected @@ -1,60 +1,60 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -111,7 +111,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -119,12 +119,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -268,12 +268,12 @@ procedure main() var ZF: bv1; var z_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000301"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%00000308"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -303,10 +303,10 @@ procedure main() } goto l00000361; l00000361: - assume {:captureState "addr:0x778"}true; + assume {:captureState "addr:l00000361"} true; goto l00000362; l00000362: - assume {:captureState "addr:0x77c"}true; + assume {:captureState "addr:l00000362"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4040bv64)) || L(mem, bvadd64(R8, 4040bv64))); @@ -315,14 +315,14 @@ procedure main() z_old := memory_load32_le(mem, $z_addr); mem, Gamma_mem := memory_store32_le(mem, R8, 0bv32), gamma_store32(Gamma_mem, R8, true); assert (memory_load32_le(mem, $z_addr) == z_old); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%00000376"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x78c"}true; + assume {:captureState "%00000385"} true; goto l0000034a; l0000034a: - assume {:captureState "addr:0x794"}true; + assume {:captureState "addr:l0000034a"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_read/gcc/basic_lock_read.expected b/src/test/correct/basic_lock_read/gcc/basic_lock_read.expected index d69adfe90..ed5ba3f3c 100644 --- a/src/test/correct/basic_lock_read/gcc/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/gcc/basic_lock_read.expected @@ -1,50 +1,50 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -85,7 +85,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -93,12 +93,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -210,10 +210,10 @@ procedure main() var ZF: bv1; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000002f9"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -229,7 +229,7 @@ procedure main() } goto l0000033e; l0000033e: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l0000033e"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -237,16 +237,16 @@ procedure main() z_old := memory_load32_le(mem, $z_addr); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert (memory_load32_le(mem, $z_addr) == z_old); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%0000034e"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000368"} true; goto l00000327; l00000327: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:l00000327"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_read/gcc_O2/basic_lock_read.expected b/src/test/correct/basic_lock_read/gcc_O2/basic_lock_read.expected index 37026eb07..4ce9ccd20 100644 --- a/src/test/correct/basic_lock_read/gcc_O2/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/gcc_O2/basic_lock_read.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69656bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69656bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -77,7 +77,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -85,12 +85,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -190,7 +190,7 @@ procedure main() { var z_old: bv32; lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -201,16 +201,16 @@ procedure main() } goto l0000039c; l0000039c: - assume {:captureState "addr:0x610"}true; + assume {:captureState "addr:l0000039c"} true; call rely(); assert (L(mem, bvadd64(R1, 4bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 4bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R1, 4bv64), true); assert (memory_load32_le(mem, $z_addr) == z_old); - assume {:captureState "addr:0x610"}true; + assume {:captureState "%000003a1"} true; goto l000001bd; l000001bd: - assume {:captureState "addr:0x614"}true; + assume {:captureState "addr:l000001bd"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_lock_read/gcc_no_plt_no_pic/basic_lock_read.expected b/src/test/correct/basic_lock_read/gcc_no_plt_no_pic/basic_lock_read.expected index eda8d8e1d..57655f452 100644 --- a/src/test/correct/basic_lock_read/gcc_no_plt_no_pic/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/gcc_no_plt_no_pic/basic_lock_read.expected @@ -1,50 +1,50 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -85,7 +85,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -93,12 +93,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -210,10 +210,10 @@ procedure main() var ZF: bv1; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%0000091a"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -229,7 +229,7 @@ procedure main() } goto l0000095f; l0000095f: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l0000095f"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -237,16 +237,16 @@ procedure main() z_old := memory_load32_le(mem, $z_addr); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert (memory_load32_le(mem, $z_addr) == z_old); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%0000096f"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000989"} true; goto l00000948; l00000948: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:l00000948"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_read/gcc_pic/basic_lock_read.expected b/src/test/correct/basic_lock_read/gcc_pic/basic_lock_read.expected index 924c0f016..3ec27ec86 100644 --- a/src/test/correct/basic_lock_read/gcc_pic/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/gcc_pic/basic_lock_read.expected @@ -1,58 +1,58 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -109,7 +109,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -117,12 +117,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -266,10 +266,10 @@ procedure main() var ZF: bv1; var z_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%000002f9"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -286,7 +286,7 @@ procedure main() } goto l0000033f; l0000033f: - assume {:captureState "addr:0x770"}true; + assume {:captureState "addr:l0000033f"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -295,17 +295,17 @@ procedure main() z_old := memory_load32_le(mem, $z_addr); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert (memory_load32_le(mem, $z_addr) == z_old); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%00000350"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x788"}true; + assume {:captureState "%0000036b"} true; goto l00000328; l00000328: - assume {:captureState "addr:0x78c"}true; + assume {:captureState "addr:l00000328"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_read/clang/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/clang/basic_lock_security_read.expected index b9ea1d366..5fe7cdbb9 100644 --- a/src/test/correct/basic_lock_security_read/clang/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/clang/basic_lock_security_read.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -87,7 +87,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -95,12 +95,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); @@ -210,12 +210,12 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000002f5"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000002fc"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -243,18 +243,18 @@ procedure main() } goto l0000034e; l0000034e: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l0000034e"} true; goto l0000034f; l0000034f: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l0000034f"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000364"} true; goto l00000337; l00000337: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000337"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_read/clang_O2/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/clang_O2/basic_lock_security_read.expected index 571be95a3..4acf8a3d2 100644 --- a/src/test/correct/basic_lock_security_read/clang_O2/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/clang_O2/basic_lock_security_read.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -77,7 +77,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -85,12 +85,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); @@ -198,7 +198,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); diff --git a/src/test/correct/basic_lock_security_read/clang_no_plt_no_pic/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/clang_no_plt_no_pic/basic_lock_security_read.expected index a0bc8c357..34072fcf8 100644 --- a/src/test/correct/basic_lock_security_read/clang_no_plt_no_pic/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/clang_no_plt_no_pic/basic_lock_security_read.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -87,7 +87,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -95,12 +95,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); @@ -210,12 +210,12 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000913"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%0000091a"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -243,18 +243,18 @@ procedure main() } goto l0000096c; l0000096c: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l0000096c"} true; goto l0000096d; l0000096d: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l0000096d"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000982"} true; goto l00000955; l00000955: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000955"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_read/clang_pic/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/clang_pic/basic_lock_security_read.expected index 68ce0c704..17531a14b 100644 --- a/src/test/correct/basic_lock_security_read/clang_pic/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/clang_pic/basic_lock_security_read.expected @@ -1,60 +1,60 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -111,7 +111,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -119,12 +119,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); @@ -266,12 +266,12 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%000002fd"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%00000304"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -301,20 +301,20 @@ procedure main() } goto l0000035d; l0000035d: - assume {:captureState "addr:0x778"}true; + assume {:captureState "addr:l0000035d"} true; goto l0000035e; l0000035e: - assume {:captureState "addr:0x77c"}true; + assume {:captureState "addr:l0000035e"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4040bv64)) || L(mem, bvadd64(R8, 4040bv64))); call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x788"}true; + assume {:captureState "%0000037a"} true; goto l00000346; l00000346: - assume {:captureState "addr:0x790"}true; + assume {:captureState "addr:l00000346"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_read/gcc/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/gcc/basic_lock_security_read.expected index 8ba373a5c..ca05a5a54 100644 --- a/src/test/correct/basic_lock_security_read/gcc/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/gcc/basic_lock_security_read.expected @@ -1,50 +1,50 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -85,7 +85,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -93,12 +93,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); @@ -208,10 +208,10 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000002ed"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -227,16 +227,16 @@ procedure main() } goto l00000332; l00000332: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l00000332"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%0000034a"} true; goto l0000031b; l0000031b: - assume {:captureState "addr:0x740"}true; + assume {:captureState "addr:l0000031b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_read/gcc_O2/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/gcc_O2/basic_lock_security_read.expected index cd0ed4b17..98cce1343 100644 --- a/src/test/correct/basic_lock_security_read/gcc_O2/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/gcc_O2/basic_lock_security_read.expected @@ -1,36 +1,36 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69656bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69656bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -71,7 +71,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -79,12 +79,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; @@ -194,11 +194,11 @@ procedure main() } goto l0000039c; l0000039c: - assume {:captureState "addr:0x614"}true; + assume {:captureState "addr:l0000039c"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R2, 4bv64))), (gamma_load32(Gamma_mem, bvadd64(R2, 4bv64)) || L(mem, bvadd64(R2, 4bv64))); goto l000001c2; l000001c2: - assume {:captureState "addr:0x618"}true; + assume {:captureState "addr:l000001c2"} true; return; } diff --git a/src/test/correct/basic_lock_security_read/gcc_no_plt_no_pic/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/gcc_no_plt_no_pic/basic_lock_security_read.expected index bd67c46dc..0ec9d6cd9 100644 --- a/src/test/correct/basic_lock_security_read/gcc_no_plt_no_pic/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/gcc_no_plt_no_pic/basic_lock_security_read.expected @@ -1,50 +1,50 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -85,7 +85,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -93,12 +93,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); @@ -208,10 +208,10 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000008ea"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -227,16 +227,16 @@ procedure main() } goto l0000092f; l0000092f: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l0000092f"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%00000947"} true; goto l00000918; l00000918: - assume {:captureState "addr:0x740"}true; + assume {:captureState "addr:l00000918"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_read/gcc_pic/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/gcc_pic/basic_lock_security_read.expected index 4f6536f8d..a260e19ab 100644 --- a/src/test/correct/basic_lock_security_read/gcc_pic/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/gcc_pic/basic_lock_security_read.expected @@ -1,58 +1,58 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -109,7 +109,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -117,12 +117,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); @@ -264,10 +264,10 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%000002ed"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -284,17 +284,17 @@ procedure main() } goto l00000333; l00000333: - assume {:captureState "addr:0x770"}true; + assume {:captureState "addr:l00000333"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x77c"}true; + assume {:captureState "%0000034c"} true; goto l0000031c; l0000031c: - assume {:captureState "addr:0x780"}true; + assume {:captureState "addr:l0000031c"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_write/clang/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/clang/basic_lock_security_write.expected index 24daf725a..3215ac6c4 100644 --- a/src/test/correct/basic_lock_security_write/clang/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/clang/basic_lock_security_write.expected @@ -1,48 +1,48 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -83,7 +83,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -91,12 +91,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -201,10 +201,10 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000002ea"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; call rely(); @@ -215,7 +215,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); assert ((bvadd64(R8, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000002fc"} true; R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); @@ -226,7 +226,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R10); assert ((bvadd64(R9, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x730"}true; + assume {:captureState "%00000310"} true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> true); @@ -236,7 +236,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), true); assert ((bvadd64(R9, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%0000031c"} true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); @@ -245,7 +245,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), true); assert ((bvadd64(R8, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%00000323"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_lock_security_write/clang_O2/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/clang_O2/basic_lock_security_write.expected index c6578965b..610776107 100644 --- a/src/test/correct/basic_lock_security_write/clang_O2/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/clang_O2/basic_lock_security_write.expected @@ -1,41 +1,41 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -76,7 +76,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -84,12 +84,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -192,7 +192,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; @@ -204,7 +204,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); assert ((bvadd64(R8, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002d6"} true; call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); @@ -213,6 +213,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), true); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000002dd"} true; return; } diff --git a/src/test/correct/basic_lock_security_write/clang_no_plt_no_pic/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/clang_no_plt_no_pic/basic_lock_security_write.expected index 24daf725a..545f5c2ee 100644 --- a/src/test/correct/basic_lock_security_write/clang_no_plt_no_pic/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/clang_no_plt_no_pic/basic_lock_security_write.expected @@ -1,48 +1,48 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -83,7 +83,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -91,12 +91,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -201,10 +201,10 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000008c7"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; call rely(); @@ -215,7 +215,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); assert ((bvadd64(R8, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000008d9"} true; R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); @@ -226,7 +226,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R10); assert ((bvadd64(R9, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x730"}true; + assume {:captureState "%000008ed"} true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> true); @@ -236,7 +236,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), true); assert ((bvadd64(R9, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%000008f9"} true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); @@ -245,7 +245,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), true); assert ((bvadd64(R8, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%00000900"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_lock_security_write/clang_pic/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/clang_pic/basic_lock_security_write.expected index 9df716c53..de3ed4f9c 100644 --- a/src/test/correct/basic_lock_security_write/clang_pic/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/clang_pic/basic_lock_security_write.expected @@ -1,56 +1,56 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -107,7 +107,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -115,12 +115,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -257,10 +257,10 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%000002f2"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -273,7 +273,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R8, R9[32:0]), gamma_store32(Gamma_mem, R8, Gamma_R9); assert ((R8 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%0000030b"} true; R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := 65536bv64, true; call rely(); @@ -286,7 +286,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R9, R10[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R10); assert ((R9 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%00000326"} true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, R9) ==> true); @@ -296,7 +296,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R9, 0bv32), gamma_store32(Gamma_mem, R9, true); assert ((R9 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x780"}true; + assume {:captureState "%00000332"} true; call rely(); assert (L(mem, R8) ==> true); z_old := memory_load32_le(mem, $z_addr); @@ -305,7 +305,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R8, 0bv32), gamma_store32(Gamma_mem, R8, true); assert ((R8 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%00000339"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_lock_security_write/gcc/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/gcc/basic_lock_security_write.expected index cc85715b0..1bde78af8 100644 --- a/src/test/correct/basic_lock_security_write/gcc/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/gcc/basic_lock_security_write.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -87,12 +87,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -197,10 +197,10 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000302"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -212,7 +212,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%0000031a"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); @@ -224,7 +224,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%00000334"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -235,7 +235,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x744"}true; + assume {:captureState "%00000346"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -246,7 +246,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x750"}true; + assume {:captureState "%00000358"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_write/gcc_O2/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/gcc_O2/basic_lock_security_write.expected index d76f52173..d0674a81c 100644 --- a/src/test/correct/basic_lock_security_write/gcc_O2/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/gcc_O2/basic_lock_security_write.expected @@ -1,41 +1,41 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -76,7 +76,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -84,12 +84,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -192,7 +192,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; @@ -204,7 +204,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), true); assert ((bvadd64(R1, 20bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x60c"}true; + assume {:captureState "%000001bd"} true; call rely(); assert (L(mem, bvadd64(R2, 4bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); @@ -213,6 +213,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R2, 4bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R2, 4bv64), true); assert ((bvadd64(R2, 4bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x610"}true; + assume {:captureState "%000001c4"} true; return; } diff --git a/src/test/correct/basic_lock_security_write/gcc_no_plt_no_pic/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/gcc_no_plt_no_pic/basic_lock_security_write.expected index cc85715b0..756ec0e54 100644 --- a/src/test/correct/basic_lock_security_write/gcc_no_plt_no_pic/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/gcc_no_plt_no_pic/basic_lock_security_write.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -87,12 +87,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -197,10 +197,10 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000925"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -212,7 +212,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%0000093d"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); @@ -224,7 +224,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%00000957"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -235,7 +235,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x744"}true; + assume {:captureState "%00000969"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -246,7 +246,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x750"}true; + assume {:captureState "%0000097b"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_write/gcc_pic/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/gcc_pic/basic_lock_security_write.expected index 1289cc1d0..d3d4f6717 100644 --- a/src/test/correct/basic_lock_security_write/gcc_pic/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/gcc_pic/basic_lock_security_write.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -103,7 +103,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -111,12 +111,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -253,10 +253,10 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000302"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -269,7 +269,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%0000031b"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -282,7 +282,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%00000336"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -294,7 +294,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%00000349"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -306,7 +306,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x790"}true; + assume {:captureState "%0000035c"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_unlock/clang/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/clang/basic_lock_unlock.expected index 8b9536cd6..8571e0d28 100644 --- a/src/test/correct/basic_lock_unlock/clang/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/clang/basic_lock_unlock.expected @@ -1,37 +1,37 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -72,7 +72,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -80,12 +80,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -186,7 +186,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -195,7 +195,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000002d6"} true; R8, Gamma_R8 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); @@ -204,6 +204,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%000002e7"} true; return; } diff --git a/src/test/correct/basic_lock_unlock/clang_O2/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/clang_O2/basic_lock_unlock.expected index e5fa90b68..1c48c94b8 100644 --- a/src/test/correct/basic_lock_unlock/clang_O2/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/clang_O2/basic_lock_unlock.expected @@ -1,39 +1,39 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -74,7 +74,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -82,12 +82,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -188,7 +188,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; @@ -199,13 +199,13 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000002e0"} true; call rely(); assert (L(mem, bvadd64(R10, 56bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R10, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R10, 56bv64), true); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%000002e7"} true; return; } diff --git a/src/test/correct/basic_lock_unlock/clang_no_plt_no_pic/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/clang_no_plt_no_pic/basic_lock_unlock.expected index 8b9536cd6..38fc839c6 100644 --- a/src/test/correct/basic_lock_unlock/clang_no_plt_no_pic/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/clang_no_plt_no_pic/basic_lock_unlock.expected @@ -1,37 +1,37 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -72,7 +72,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -80,12 +80,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -186,7 +186,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -195,7 +195,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000865"} true; R8, Gamma_R8 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); @@ -204,6 +204,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000876"} true; return; } diff --git a/src/test/correct/basic_lock_unlock/clang_pic/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/clang_pic/basic_lock_unlock.expected index 5d1ee5164..f9c42273c 100644 --- a/src/test/correct/basic_lock_unlock/clang_pic/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/clang_pic/basic_lock_unlock.expected @@ -1,45 +1,45 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -96,7 +96,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -104,12 +104,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -242,7 +242,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); @@ -253,7 +253,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000002e5"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -264,6 +264,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R8, 0bv32), gamma_store32(Gamma_mem, R8, true); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x770"}true; + assume {:captureState "%000002fd"} true; return; } diff --git a/src/test/correct/basic_lock_unlock/gcc/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/gcc/basic_lock_unlock.expected index c7c3d5b67..92fa648ce 100644 --- a/src/test/correct/basic_lock_unlock/gcc/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/gcc/basic_lock_unlock.expected @@ -1,35 +1,35 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -70,7 +70,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -78,12 +78,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -184,7 +184,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -194,7 +194,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002e4"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -203,7 +203,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%000002f6"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_lock_unlock/gcc_O2/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/gcc_O2/basic_lock_unlock.expected index cb994b9e1..e16dad000 100644 --- a/src/test/correct/basic_lock_unlock/gcc_O2/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/gcc_O2/basic_lock_unlock.expected @@ -1,39 +1,39 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R3: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }R3: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R3: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R3: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -74,7 +74,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -82,12 +82,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -188,7 +188,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R3, Gamma_R3 := 1bv64, true; @@ -199,13 +199,13 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R3[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R3); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x610"}true; + assume {:captureState "%000001c3"} true; call rely(); assert (L(mem, bvadd64(R2, 4bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R2, 4bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R2, 4bv64), true); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x614"}true; + assume {:captureState "%000001ca"} true; return; } diff --git a/src/test/correct/basic_lock_unlock/gcc_no_plt_no_pic/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/gcc_no_plt_no_pic/basic_lock_unlock.expected index c7c3d5b67..3fd503dac 100644 --- a/src/test/correct/basic_lock_unlock/gcc_no_plt_no_pic/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/gcc_no_plt_no_pic/basic_lock_unlock.expected @@ -1,35 +1,35 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -70,7 +70,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -78,12 +78,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -184,7 +184,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -194,7 +194,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%0000088b"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -203,7 +203,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%0000089d"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_lock_unlock/gcc_pic/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/gcc_pic/basic_lock_unlock.expected index ad9e338ed..21faf7ae0 100644 --- a/src/test/correct/basic_lock_unlock/gcc_pic/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/gcc_pic/basic_lock_unlock.expected @@ -1,43 +1,43 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -94,7 +94,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -102,12 +102,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -240,7 +240,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -251,7 +251,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000002e5"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -261,7 +261,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((z_old == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == x_old) && (memory_load32_le(mem, $z_addr) == z_old))); - assume {:captureState "addr:0x76c"}true; + assume {:captureState "%000002f8"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_loop_assign/clang/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/clang/basic_loop_assign.expected index d8438552b..e640f145d 100644 --- a/src/test/correct/basic_loop_assign/clang/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/clang/basic_loop_assign.expected @@ -1,37 +1,37 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"}bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"}bvslt32(bv32, bv32) returns (bool); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -72,7 +72,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -80,12 +80,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); @@ -186,7 +186,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 20bv64, true; call rely(); @@ -194,7 +194,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert (((memory_load32_le(mem, $x_addr) == x_old) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (x_old == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(x_old, 10bv32))); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000002ce"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_loop_assign/clang_O2/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/clang_O2/basic_loop_assign.expected index e70e4ae90..fd335dcf3 100644 --- a/src/test/correct/basic_loop_assign/clang_O2/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/clang_O2/basic_loop_assign.expected @@ -1,37 +1,37 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"}bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"}bvslt32(bv32, bv32) returns (bool); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -72,7 +72,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -80,12 +80,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); @@ -186,7 +186,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 20bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -195,6 +195,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); assert (((memory_load32_le(mem, $x_addr) == x_old) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (x_old == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(x_old, 10bv32))); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002d3"} true; return; } diff --git a/src/test/correct/basic_loop_assign/clang_no_plt_no_pic/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/clang_no_plt_no_pic/basic_loop_assign.expected index d8438552b..1fa831faf 100644 --- a/src/test/correct/basic_loop_assign/clang_no_plt_no_pic/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/clang_no_plt_no_pic/basic_loop_assign.expected @@ -1,37 +1,37 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"}bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"}bvslt32(bv32, bv32) returns (bool); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -72,7 +72,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -80,12 +80,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); @@ -186,7 +186,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 20bv64, true; call rely(); @@ -194,7 +194,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert (((memory_load32_le(mem, $x_addr) == x_old) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (x_old == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(x_old, 10bv32))); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000845"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_loop_assign/clang_pic/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/clang_pic/basic_loop_assign.expected index ef03cf161..a4d7eaa2e 100644 --- a/src/test/correct/basic_loop_assign/clang_pic/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/clang_pic/basic_loop_assign.expected @@ -1,45 +1,45 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"}bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"}bvslt32(bv32, bv32) returns (bool); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -88,7 +88,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -96,12 +96,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); @@ -218,7 +218,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); @@ -228,7 +228,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert (((memory_load32_le(mem, $x_addr) == x_old) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (x_old == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(x_old, 10bv32))); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000002d9"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_loop_assign/gcc/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/gcc/basic_loop_assign.expected index bdb3e223c..136c8bbe8 100644 --- a/src/test/correct/basic_loop_assign/gcc/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/gcc/basic_loop_assign.expected @@ -1,35 +1,35 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"}bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"}bvslt32(bv32, bv32) returns (bool); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -70,7 +70,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -78,12 +78,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); @@ -184,7 +184,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 20bv64, true; @@ -193,7 +193,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (((memory_load32_le(mem, $x_addr) == x_old) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (x_old == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(x_old, 10bv32))); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002d8"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_loop_assign/gcc_O2/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/gcc_O2/basic_loop_assign.expected index de64496b6..c4ffcbeff 100644 --- a/src/test/correct/basic_loop_assign/gcc_O2/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/gcc_O2/basic_loop_assign.expected @@ -1,37 +1,37 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"}bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"}bvslt32(bv32, bv32) returns (bool); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -72,7 +72,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -80,12 +80,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); @@ -186,7 +186,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 20bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -195,6 +195,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R2); assert (((memory_load32_le(mem, $x_addr) == x_old) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (x_old == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(x_old, 10bv32))); - assume {:captureState "addr:0x60c"}true; + assume {:captureState "%000001bd"} true; return; } diff --git a/src/test/correct/basic_loop_assign/gcc_no_plt_no_pic/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/gcc_no_plt_no_pic/basic_loop_assign.expected index bdb3e223c..c57072406 100644 --- a/src/test/correct/basic_loop_assign/gcc_no_plt_no_pic/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/gcc_no_plt_no_pic/basic_loop_assign.expected @@ -1,35 +1,35 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"}bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"}bvslt32(bv32, bv32) returns (bool); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -70,7 +70,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -78,12 +78,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); @@ -184,7 +184,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 20bv64, true; @@ -193,7 +193,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (((memory_load32_le(mem, $x_addr) == x_old) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (x_old == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(x_old, 10bv32))); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%0000085b"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_loop_assign/gcc_pic/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/gcc_pic/basic_loop_assign.expected index b473c8028..263ae5ca8 100644 --- a/src/test/correct/basic_loop_assign/gcc_pic/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/gcc_pic/basic_loop_assign.expected @@ -1,43 +1,43 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"}bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"}bvslt32(bv32, bv32) returns (bool); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -86,7 +86,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -94,12 +94,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); @@ -216,7 +216,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -226,7 +226,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (((memory_load32_le(mem, $x_addr) == x_old) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (x_old == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(x_old, 10bv32))); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000002d9"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_operation_evaluation/clang/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/clang/basic_operation_evaluation.expected index 6e420eccc..887ea3b58 100644 --- a/src/test/correct/basic_operation_evaluation/clang/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/clang/basic_operation_evaluation.expected @@ -1,64 +1,64 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R10: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1952bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvmul"}bvmul64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot32(bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvor"}bvor32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvsdiv"}bvsdiv33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvxor"}bvxor32(bv32, bv32) returns (bv32); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1952bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -99,7 +99,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -108,9 +108,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -219,38 +219,38 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000338"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000340"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000348"} true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x730"}true; + assume {:captureState "%00000355"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%00000362"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := zero_extend32_32(bvxor32(R8[32:0], R9[32:0])), (Gamma_R9 && Gamma_R8); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%0000037f"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); R8, Gamma_R8 := zero_extend32_32(bvor32(R8[32:0], R9[32:0])), (Gamma_R9 && Gamma_R8); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%0000039c"} true; R8, Gamma_R8 := 30bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000003a9"} true; R8, Gamma_R8 := 17bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%000003b6"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); assert Gamma_R10; @@ -274,7 +274,7 @@ procedure main() NF, Gamma_NF := bvadd32(#5, 1bv32)[32:31], Gamma_#5; R8, Gamma_R8 := zero_extend32_32(bvadd32(#5, 1bv32)), Gamma_#5; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x780"}true; + assume {:captureState "%00000407"} true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_operation_evaluation/clang_O2/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/clang_O2/basic_operation_evaluation.expected index 863d7bd46..dfc8a4e7d 100644 --- a/src/test/correct/basic_operation_evaluation/clang_O2/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/clang_O2/basic_operation_evaluation.expected @@ -1,14 +1,14 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1840bv64); -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1840bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_operation_evaluation/clang_no_plt_no_pic/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/clang_no_plt_no_pic/basic_operation_evaluation.expected index 68868d22c..73df7b339 100644 --- a/src/test/correct/basic_operation_evaluation/clang_no_plt_no_pic/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/clang_no_plt_no_pic/basic_operation_evaluation.expected @@ -1,64 +1,64 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R10: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1952bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvmul"}bvmul64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot32(bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvor"}bvor32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvsdiv"}bvsdiv33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvxor"}bvxor32(bv32, bv32) returns (bv32); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1952bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -99,7 +99,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -108,9 +108,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -219,38 +219,38 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000a1b"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000a23"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000a2b"} true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x730"}true; + assume {:captureState "%00000a38"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%00000a45"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := zero_extend32_32(bvxor32(R8[32:0], R9[32:0])), (Gamma_R9 && Gamma_R8); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000a62"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); R8, Gamma_R8 := zero_extend32_32(bvor32(R8[32:0], R9[32:0])), (Gamma_R9 && Gamma_R8); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000a7f"} true; R8, Gamma_R8 := 30bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%00000a8c"} true; R8, Gamma_R8 := 17bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%00000a99"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); assert Gamma_R10; @@ -274,7 +274,7 @@ procedure main() NF, Gamma_NF := bvadd32(#5, 1bv32)[32:31], Gamma_#5; R8, Gamma_R8 := zero_extend32_32(bvadd32(#5, 1bv32)), Gamma_#5; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x780"}true; + assume {:captureState "%00000aea"} true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_operation_evaluation/clang_pic/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/clang_pic/basic_operation_evaluation.expected index 68868d22c..73df7b339 100644 --- a/src/test/correct/basic_operation_evaluation/clang_pic/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/clang_pic/basic_operation_evaluation.expected @@ -1,64 +1,64 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R10: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1952bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvmul"}bvmul64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot32(bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvor"}bvor32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvsdiv"}bvsdiv33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvxor"}bvxor32(bv32, bv32) returns (bv32); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1952bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -99,7 +99,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -108,9 +108,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -219,38 +219,38 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000a1b"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000a23"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000a2b"} true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x730"}true; + assume {:captureState "%00000a38"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%00000a45"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := zero_extend32_32(bvxor32(R8[32:0], R9[32:0])), (Gamma_R9 && Gamma_R8); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000a62"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); R8, Gamma_R8 := zero_extend32_32(bvor32(R8[32:0], R9[32:0])), (Gamma_R9 && Gamma_R8); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000a7f"} true; R8, Gamma_R8 := 30bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%00000a8c"} true; R8, Gamma_R8 := 17bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%00000a99"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); assert Gamma_R10; @@ -274,7 +274,7 @@ procedure main() NF, Gamma_NF := bvadd32(#5, 1bv32)[32:31], Gamma_#5; R8, Gamma_R8 := zero_extend32_32(bvadd32(#5, 1bv32)), Gamma_#5; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x780"}true; + assume {:captureState "%00000aea"} true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_operation_evaluation/gcc/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/gcc/basic_operation_evaluation.expected index 527e11509..14d6921a1 100644 --- a/src/test/correct/basic_operation_evaluation/gcc/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/gcc/basic_operation_evaluation.expected @@ -1,56 +1,56 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1948bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvmul"}bvmul64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvnot"}bvnot32(bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvor"}bvor32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvsdiv"}bvsdiv33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvxor"}bvxor32(bv32, bv32) returns (bv32); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1948bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,7 +91,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,9 +100,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,34 +199,34 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%0000032a"} true; stack, Gamma_stack := memory_store64_le(stack, R31, R1), gamma_store64(Gamma_stack, R31, Gamma_R1); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000332"} true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R0); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%0000033f"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%0000034c"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R0, Gamma_R0 := zero_extend32_32(bvxor32(R1[32:0], R0[32:0])), (Gamma_R0 && Gamma_R1); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%00000369"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := zero_extend32_32(bvor32(R1[32:0], R0[32:0])), (Gamma_R0 && Gamma_R1); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x74c"}true; + assume {:captureState "%00000386"} true; R0, Gamma_R0 := 30bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R0); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%00000393"} true; R0, Gamma_R0 := 17bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%000003a0"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); assert Gamma_R1; @@ -245,7 +245,7 @@ procedure main() R1, Gamma_R1 := zero_extend32_32(bvmul64(zero_extend32_32(R2[32:0]), zero_extend32_32(R1[32:0]))[32:0]), (Gamma_R1 && Gamma_R2); R0, Gamma_R0 := zero_extend32_32(bvadd32(bvadd32(R0[32:0], bvnot32(R1[32:0])), 1bv32)), (Gamma_R1 && Gamma_R0); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%000003dc"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_operation_evaluation/gcc_O2/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/gcc_O2/basic_operation_evaluation.expected index 418f9a5da..db578d839 100644 --- a/src/test/correct/basic_operation_evaluation/gcc_O2/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/gcc_O2/basic_operation_evaluation.expected @@ -1,14 +1,14 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1896bv64); -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1896bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_operation_evaluation/gcc_no_plt_no_pic/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/gcc_no_plt_no_pic/basic_operation_evaluation.expected index 0bfd7448d..c13871a69 100644 --- a/src/test/correct/basic_operation_evaluation/gcc_no_plt_no_pic/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/gcc_no_plt_no_pic/basic_operation_evaluation.expected @@ -1,56 +1,56 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1948bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvmul"}bvmul64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvnot"}bvnot32(bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvor"}bvor32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvsdiv"}bvsdiv33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvxor"}bvxor32(bv32, bv32) returns (bv32); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1948bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,7 +91,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,9 +100,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,34 +199,34 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000009e5"} true; stack, Gamma_stack := memory_store64_le(stack, R31, R1), gamma_store64(Gamma_stack, R31, Gamma_R1); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000009ed"} true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R0); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000009fa"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%00000a07"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R0, Gamma_R0 := zero_extend32_32(bvxor32(R1[32:0], R0[32:0])), (Gamma_R0 && Gamma_R1); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%00000a24"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := zero_extend32_32(bvor32(R1[32:0], R0[32:0])), (Gamma_R0 && Gamma_R1); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x74c"}true; + assume {:captureState "%00000a41"} true; R0, Gamma_R0 := 30bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R0); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%00000a4e"} true; R0, Gamma_R0 := 17bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%00000a5b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); assert Gamma_R1; @@ -245,7 +245,7 @@ procedure main() R1, Gamma_R1 := zero_extend32_32(bvmul64(zero_extend32_32(R2[32:0]), zero_extend32_32(R1[32:0]))[32:0]), (Gamma_R1 && Gamma_R2); R0, Gamma_R0 := zero_extend32_32(bvadd32(bvadd32(R0[32:0], bvnot32(R1[32:0])), 1bv32)), (Gamma_R1 && Gamma_R0); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%00000a97"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_operation_evaluation/gcc_pic/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/gcc_pic/basic_operation_evaluation.expected index 0bfd7448d..c13871a69 100644 --- a/src/test/correct/basic_operation_evaluation/gcc_pic/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/gcc_pic/basic_operation_evaluation.expected @@ -1,56 +1,56 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1948bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvmul"}bvmul64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvnot"}bvnot32(bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvor"}bvor32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvsdiv"}bvsdiv33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvxor"}bvxor32(bv32, bv32) returns (bv32); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1948bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,7 +91,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,9 +100,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,34 +199,34 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000009e5"} true; stack, Gamma_stack := memory_store64_le(stack, R31, R1), gamma_store64(Gamma_stack, R31, Gamma_R1); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000009ed"} true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R0); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000009fa"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%00000a07"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R0, Gamma_R0 := zero_extend32_32(bvxor32(R1[32:0], R0[32:0])), (Gamma_R0 && Gamma_R1); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%00000a24"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := zero_extend32_32(bvor32(R1[32:0], R0[32:0])), (Gamma_R0 && Gamma_R1); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x74c"}true; + assume {:captureState "%00000a41"} true; R0, Gamma_R0 := 30bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R0); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%00000a4e"} true; R0, Gamma_R0 := 17bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%00000a5b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); assert Gamma_R1; @@ -245,7 +245,7 @@ procedure main() R1, Gamma_R1 := zero_extend32_32(bvmul64(zero_extend32_32(R2[32:0]), zero_extend32_32(R1[32:0]))[32:0]), (Gamma_R1 && Gamma_R2); R0, Gamma_R0 := zero_extend32_32(bvadd32(bvadd32(R0[32:0], bvnot32(R1[32:0])), 1bv32)), (Gamma_R1 && Gamma_R0); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%00000a97"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_read/clang/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/clang/basic_sec_policy_read.expected index 5ccdb0df0..4cfc49619 100644 --- a/src/test/correct/basic_sec_policy_read/clang/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/clang/basic_sec_policy_read.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -87,7 +87,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -95,12 +95,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -210,15 +210,15 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000002f5"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000309"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); @@ -246,15 +246,15 @@ procedure main() } goto l0000035b; l0000035b: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l0000035b"} true; goto l0000035c; l0000035c: - assume {:captureState "addr:0x740"}true; + assume {:captureState "addr:l0000035c"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000364"} true; goto l00000344; l00000344: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000344"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_read/clang_O2/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/clang_O2/basic_sec_policy_read.expected index 9254d1cf3..a3b6da627 100644 --- a/src/test/correct/basic_sec_policy_read/clang_O2/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/clang_O2/basic_sec_policy_read.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -77,7 +77,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -85,12 +85,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -198,7 +198,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); diff --git a/src/test/correct/basic_sec_policy_read/clang_no_plt_no_pic/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/clang_no_plt_no_pic/basic_sec_policy_read.expected index dd69ae193..0177f85d1 100644 --- a/src/test/correct/basic_sec_policy_read/clang_no_plt_no_pic/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/clang_no_plt_no_pic/basic_sec_policy_read.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -87,7 +87,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -95,12 +95,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -210,15 +210,15 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000913"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000927"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); @@ -246,15 +246,15 @@ procedure main() } goto l00000979; l00000979: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000979"} true; goto l0000097a; l0000097a: - assume {:captureState "addr:0x740"}true; + assume {:captureState "addr:l0000097a"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000982"} true; goto l00000962; l00000962: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000962"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_read/clang_pic/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/clang_pic/basic_sec_policy_read.expected index 89f602f16..5b56d78b1 100644 --- a/src/test/correct/basic_sec_policy_read/clang_pic/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/clang_pic/basic_sec_policy_read.expected @@ -1,60 +1,60 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -111,7 +111,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -119,12 +119,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -266,17 +266,17 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%000002fd"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4040bv64)) || L(mem, bvadd64(R8, 4040bv64))); call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%00000318"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -306,15 +306,15 @@ procedure main() } goto l00000371; l00000371: - assume {:captureState "addr:0x784"}true; + assume {:captureState "addr:l00000371"} true; goto l00000372; l00000372: - assume {:captureState "addr:0x788"}true; + assume {:captureState "addr:l00000372"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); - assume {:captureState "addr:0x788"}true; + assume {:captureState "%0000037a"} true; goto l0000035a; l0000035a: - assume {:captureState "addr:0x790"}true; + assume {:captureState "addr:l0000035a"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_read/gcc/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/gcc/basic_sec_policy_read.expected index 8aaa1213b..9834a0a98 100644 --- a/src/test/correct/basic_sec_policy_read/gcc/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/gcc/basic_sec_policy_read.expected @@ -1,50 +1,50 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -85,7 +85,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -93,12 +93,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -208,14 +208,14 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000300"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -231,12 +231,12 @@ procedure main() } goto l00000345; l00000345: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000345"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%0000034a"} true; goto l0000032e; l0000032e: - assume {:captureState "addr:0x740"}true; + assume {:captureState "addr:l0000032e"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_read/gcc_O2/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/gcc_O2/basic_sec_policy_read.expected index 3ef4dd28b..e6a2012ed 100644 --- a/src/test/correct/basic_sec_policy_read/gcc_O2/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/gcc_O2/basic_sec_policy_read.expected @@ -1,36 +1,36 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69656bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69656bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -71,7 +71,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -79,12 +79,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; @@ -194,11 +194,11 @@ procedure main() } goto l0000039c; l0000039c: - assume {:captureState "addr:0x614"}true; + assume {:captureState "addr:l0000039c"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R2, 4bv64))), (gamma_load32(Gamma_mem, bvadd64(R2, 4bv64)) || L(mem, bvadd64(R2, 4bv64))); goto l000001c2; l000001c2: - assume {:captureState "addr:0x618"}true; + assume {:captureState "addr:l000001c2"} true; return; } diff --git a/src/test/correct/basic_sec_policy_read/gcc_no_plt_no_pic/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/gcc_no_plt_no_pic/basic_sec_policy_read.expected index 1e3b29dbd..c56bd1044 100644 --- a/src/test/correct/basic_sec_policy_read/gcc_no_plt_no_pic/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/gcc_no_plt_no_pic/basic_sec_policy_read.expected @@ -1,50 +1,50 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -85,7 +85,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -93,12 +93,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -208,14 +208,14 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000008fd"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -231,12 +231,12 @@ procedure main() } goto l00000942; l00000942: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000942"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%00000947"} true; goto l0000092b; l0000092b: - assume {:captureState "addr:0x740"}true; + assume {:captureState "addr:l0000092b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_read/gcc_pic/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/gcc_pic/basic_sec_policy_read.expected index e31b86ffc..45001e96f 100644 --- a/src/test/correct/basic_sec_policy_read/gcc_pic/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/gcc_pic/basic_sec_policy_read.expected @@ -1,58 +1,58 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -109,7 +109,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -117,12 +117,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -264,7 +264,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -272,7 +272,7 @@ procedure main() call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%00000301"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -289,12 +289,12 @@ procedure main() } goto l00000347; l00000347: - assume {:captureState "addr:0x77c"}true; + assume {:captureState "addr:l00000347"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x77c"}true; + assume {:captureState "%0000034c"} true; goto l00000330; l00000330: - assume {:captureState "addr:0x780"}true; + assume {:captureState "addr:l00000330"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_write/clang/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/clang/basic_sec_policy_write.expected index 22367a2d9..2dc7e76a3 100644 --- a/src/test/correct/basic_sec_policy_write/clang/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/clang/basic_sec_policy_write.expected @@ -1,48 +1,48 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -83,7 +83,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -91,12 +91,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -199,10 +199,10 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000002ee"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -212,7 +212,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000300"} true; R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R8, Gamma_R8 := 69632bv64, true; call rely(); @@ -222,7 +222,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), Gamma_R10); assert ((bvadd64(R8, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x730"}true; + assume {:captureState "%00000314"} true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> true); @@ -231,7 +231,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); assert ((bvadd64(R8, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%00000320"} true; R8, Gamma_R8 := 2bv64, true; call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R8); @@ -240,7 +240,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%0000032d"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_sec_policy_write/clang_O2/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/clang_O2/basic_sec_policy_write.expected index f68544c6f..1d4c8067f 100644 --- a/src/test/correct/basic_sec_policy_write/clang_O2/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/clang_O2/basic_sec_policy_write.expected @@ -1,43 +1,43 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -78,7 +78,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -86,12 +86,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -192,7 +192,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; @@ -204,7 +204,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); assert ((bvadd64(R8, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000002df"} true; call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R10); z_old := memory_load32_le(mem, $z_addr); @@ -212,6 +212,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R10); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%000002e7"} true; return; } diff --git a/src/test/correct/basic_sec_policy_write/clang_no_plt_no_pic/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/clang_no_plt_no_pic/basic_sec_policy_write.expected index 22367a2d9..ee74210ac 100644 --- a/src/test/correct/basic_sec_policy_write/clang_no_plt_no_pic/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/clang_no_plt_no_pic/basic_sec_policy_write.expected @@ -1,48 +1,48 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -83,7 +83,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -91,12 +91,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -199,10 +199,10 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000008d7"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -212,7 +212,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000008e9"} true; R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R8, Gamma_R8 := 69632bv64, true; call rely(); @@ -222,7 +222,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), Gamma_R10); assert ((bvadd64(R8, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x730"}true; + assume {:captureState "%000008fd"} true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> true); @@ -231,7 +231,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); assert ((bvadd64(R8, 56bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%00000909"} true; R8, Gamma_R8 := 2bv64, true; call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R8); @@ -240,7 +240,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000916"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_sec_policy_write/clang_pic/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/clang_pic/basic_sec_policy_write.expected index 38704ec35..c0e78cc8c 100644 --- a/src/test/correct/basic_sec_policy_write/clang_pic/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/clang_pic/basic_sec_policy_write.expected @@ -1,56 +1,56 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -107,7 +107,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -115,12 +115,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -255,10 +255,10 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%000002f6"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4032bv64)) || L(mem, bvadd64(R9, 4032bv64))); @@ -270,7 +270,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert ((R9 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%0000030f"} true; R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R8, Gamma_R8 := 65536bv64, true; call rely(); @@ -282,7 +282,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R8, R10[32:0]), gamma_store32(Gamma_mem, R8, Gamma_R10); assert ((R8 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%0000032a"} true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, R8) ==> true); @@ -291,7 +291,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R8, 0bv32), gamma_store32(Gamma_mem, R8, true); assert ((R8 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x780"}true; + assume {:captureState "%00000336"} true; R8, Gamma_R8 := 2bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); @@ -300,7 +300,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert ((R9 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x788"}true; + assume {:captureState "%00000343"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_sec_policy_write/gcc/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/gcc/basic_sec_policy_write.expected index f14dd2176..9a5e68d88 100644 --- a/src/test/correct/basic_sec_policy_write/gcc/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/gcc/basic_sec_policy_write.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -87,12 +87,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -195,10 +195,10 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000306"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -209,7 +209,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%0000031e"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); @@ -220,7 +220,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%00000338"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -230,7 +230,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x744"}true; + assume {:captureState "%0000034a"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 2bv64, true; @@ -241,7 +241,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%00000362"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_write/gcc_O2/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/gcc_O2/basic_sec_policy_write.expected index fabce9632..c435de35d 100644 --- a/src/test/correct/basic_sec_policy_write/gcc_O2/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/gcc_O2/basic_sec_policy_write.expected @@ -1,43 +1,43 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R3: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }R3: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R3: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R3: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -78,7 +78,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -86,12 +86,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -192,7 +192,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R3, Gamma_R3 := 2bv64, true; @@ -204,7 +204,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), true); assert ((bvadd64(R1, 20bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x610"}true; + assume {:captureState "%000001c2"} true; call rely(); assert (L(mem, bvadd64(R2, 4bv64)) ==> Gamma_R3); z_old := memory_load32_le(mem, $z_addr); @@ -212,6 +212,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R2, 4bv64), R3[32:0]), gamma_store32(Gamma_mem, bvadd64(R2, 4bv64), Gamma_R3); assert ((bvadd64(R2, 4bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x614"}true; + assume {:captureState "%000001ca"} true; return; } diff --git a/src/test/correct/basic_sec_policy_write/gcc_no_plt_no_pic/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/gcc_no_plt_no_pic/basic_sec_policy_write.expected index f14dd2176..c83866d0f 100644 --- a/src/test/correct/basic_sec_policy_write/gcc_no_plt_no_pic/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/gcc_no_plt_no_pic/basic_sec_policy_write.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -87,12 +87,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -195,10 +195,10 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000935"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -209,7 +209,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%0000094d"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); @@ -220,7 +220,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%00000967"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -230,7 +230,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x744"}true; + assume {:captureState "%00000979"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 2bv64, true; @@ -241,7 +241,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%00000991"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_write/gcc_pic/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/gcc_pic/basic_sec_policy_write.expected index c9e53cb63..3ba5940fc 100644 --- a/src/test/correct/basic_sec_policy_write/gcc_pic/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/gcc_pic/basic_sec_policy_write.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -103,7 +103,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -111,12 +111,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -251,10 +251,10 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000306"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -266,7 +266,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%0000031f"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -278,7 +278,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%0000033a"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -289,7 +289,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%0000034d"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -301,7 +301,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert ((z_old != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); - assume {:captureState "addr:0x794"}true; + assume {:captureState "%00000366"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basicassign_gamma0/clang/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/clang/basicassign_gamma0.expected index 4a6b81ff1..592173b60 100644 --- a/src/test/correct/basicassign_gamma0/clang/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/clang/basicassign_gamma0.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69684bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69684bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -77,7 +77,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -85,12 +85,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -186,7 +186,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -194,7 +194,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002d9"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basicassign_gamma0/clang_O2/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/clang_O2/basicassign_gamma0.expected index a3d5ee86d..3d9ca451f 100644 --- a/src/test/correct/basicassign_gamma0/clang_O2/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/clang_O2/basicassign_gamma0.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69684bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69684bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -77,7 +77,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -85,12 +85,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -186,7 +186,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -195,6 +195,6 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000002de"} true; return; } diff --git a/src/test/correct/basicassign_gamma0/clang_no_plt_no_pic/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/clang_no_plt_no_pic/basicassign_gamma0.expected index 4a6b81ff1..06a2746a5 100644 --- a/src/test/correct/basicassign_gamma0/clang_no_plt_no_pic/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/clang_no_plt_no_pic/basicassign_gamma0.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69684bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69684bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -77,7 +77,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -85,12 +85,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -186,7 +186,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -194,7 +194,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%0000085d"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basicassign_gamma0/clang_pic/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/clang_pic/basicassign_gamma0.expected index 8d3b6f254..2677baa88 100644 --- a/src/test/correct/basicassign_gamma0/clang_pic/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/clang_pic/basicassign_gamma0.expected @@ -1,50 +1,50 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69684bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69684bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -101,7 +101,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -109,12 +109,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -242,7 +242,7 @@ procedure main() free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4048bv64)) || L(mem, bvadd64(R8, 4048bv64))); @@ -254,7 +254,7 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%000002ef"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basicassign_gamma0/gcc/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/gcc/basicassign_gamma0.expected index eb4fdf55d..26c44406d 100644 --- a/src/test/correct/basicassign_gamma0/gcc/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/gcc/basicassign_gamma0.expected @@ -1,40 +1,40 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69656bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69656bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -75,7 +75,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -83,12 +83,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -184,7 +184,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -194,7 +194,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%000002ed"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basicassign_gamma0/gcc_O2/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/gcc_O2/basicassign_gamma0.expected index d1e5aa131..c4568c2b3 100644 --- a/src/test/correct/basicassign_gamma0/gcc_O2/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/gcc_O2/basicassign_gamma0.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69656bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69656bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -77,7 +77,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -85,12 +85,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -186,7 +186,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; @@ -195,6 +195,6 @@ procedure main() call rely(); assert (L(mem, bvadd64(R1, 20bv64)) ==> Gamma_R2); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R2); - assume {:captureState "addr:0x610"}true; + assume {:captureState "%000001c5"} true; return; } diff --git a/src/test/correct/basicassign_gamma0/gcc_no_plt_no_pic/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/gcc_no_plt_no_pic/basicassign_gamma0.expected index eb4fdf55d..a637efeb7 100644 --- a/src/test/correct/basicassign_gamma0/gcc_no_plt_no_pic/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/gcc_no_plt_no_pic/basicassign_gamma0.expected @@ -1,40 +1,40 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69656bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69656bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -75,7 +75,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -83,12 +83,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -184,7 +184,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -194,7 +194,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000889"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basicassign_gamma0/gcc_pic/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/gcc_pic/basicassign_gamma0.expected index d09ef1c76..d5b33266a 100644 --- a/src/test/correct/basicassign_gamma0/gcc_pic/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/gcc_pic/basicassign_gamma0.expected @@ -1,48 +1,48 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69656bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69656bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -99,7 +99,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -107,12 +107,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -240,7 +240,7 @@ procedure main() free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -252,7 +252,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%000002ef"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basicfree/clang/basicfree.expected b/src/test/correct/basicfree/clang/basicfree.expected index 1de1ece3a..aefe5e23c 100644 --- a/src/test/correct/basicfree/clang/basicfree.expected +++ b/src/test/correct/basicfree/clang/basicfree.expected @@ -1,59 +1,59 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2080bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2080bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,9 +103,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -283,34 +283,34 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:0x7d4"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x7d8"}true; + assume {:captureState "%000002f2"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x7d8"}true; + assume {:captureState "%000002f8"} true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2024bv64, true; call malloc(); goto l0000030d; l0000030d: - assume {:captureState "addr:0x7e8"}true; + assume {:captureState "addr:l0000030d"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x7e8"}true; + assume {:captureState "%00000313"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 1bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x7f4"}true; + assume {:captureState "%00000327"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2048bv64, true; call #free(); goto l00000338; l00000338: - assume {:captureState "addr:0x800"}true; + assume {:captureState "addr:l00000338"} true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(#5, 8bv64)), gamma_load64(Gamma_stack, bvadd64(#5, 8bv64)); diff --git a/src/test/correct/basicfree/clang_O2/basicfree.expected b/src/test/correct/basicfree/clang_O2/basicfree.expected index 6ca38a2b2..a691307d3 100644 --- a/src/test/correct/basicfree/clang_O2/basicfree.expected +++ b/src/test/correct/basicfree/clang_O2/basicfree.expected @@ -1,12 +1,12 @@ -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }mem: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1836bv64); -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1836bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -47,7 +47,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,9 +56,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -152,6 +152,6 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; return; } diff --git a/src/test/correct/basicfree/clang_no_plt_no_pic/basicfree.expected b/src/test/correct/basicfree/clang_no_plt_no_pic/basicfree.expected index 4e90916c5..0cbefca5a 100644 --- a/src/test/correct/basicfree/clang_no_plt_no_pic/basicfree.expected +++ b/src/test/correct/basicfree/clang_no_plt_no_pic/basicfree.expected @@ -1,59 +1,59 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2080bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2080bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,9 +103,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -283,34 +283,34 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:0x7d4"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x7d8"}true; + assume {:captureState "%000008d2"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x7d8"}true; + assume {:captureState "%000008d8"} true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2024bv64, true; call malloc(); goto l000008ed; l000008ed: - assume {:captureState "addr:0x7e8"}true; + assume {:captureState "addr:l000008ed"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x7e8"}true; + assume {:captureState "%000008f3"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 1bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x7f4"}true; + assume {:captureState "%00000907"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2048bv64, true; call #free(); goto l00000918; l00000918: - assume {:captureState "addr:0x800"}true; + assume {:captureState "addr:l00000918"} true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(#5, 8bv64)), gamma_load64(Gamma_stack, bvadd64(#5, 8bv64)); diff --git a/src/test/correct/basicfree/clang_pic/basicfree.expected b/src/test/correct/basicfree/clang_pic/basicfree.expected index 4e90916c5..0cbefca5a 100644 --- a/src/test/correct/basicfree/clang_pic/basicfree.expected +++ b/src/test/correct/basicfree/clang_pic/basicfree.expected @@ -1,59 +1,59 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2080bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2080bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,9 +103,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -283,34 +283,34 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:0x7d4"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x7d8"}true; + assume {:captureState "%000008d2"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x7d8"}true; + assume {:captureState "%000008d8"} true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2024bv64, true; call malloc(); goto l000008ed; l000008ed: - assume {:captureState "addr:0x7e8"}true; + assume {:captureState "addr:l000008ed"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x7e8"}true; + assume {:captureState "%000008f3"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 1bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x7f4"}true; + assume {:captureState "%00000907"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2048bv64, true; call #free(); goto l00000918; l00000918: - assume {:captureState "addr:0x800"}true; + assume {:captureState "addr:l00000918"} true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(#5, 8bv64)), gamma_load64(Gamma_stack, bvadd64(#5, 8bv64)); diff --git a/src/test/correct/basicfree/gcc/basicfree.expected b/src/test/correct/basicfree/gcc/basicfree.expected index 1ed12b672..dfa99df58 100644 --- a/src/test/correct/basicfree/gcc/basicfree.expected +++ b/src/test/correct/basicfree/gcc/basicfree.expected @@ -1,57 +1,57 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2076bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2076bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,9 +101,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -279,12 +279,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x7d4"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x7d4"}true; + assume {:captureState "%000002e8"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x7d4"}true; + assume {:captureState "%000002ee"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 4bv64, true; @@ -292,21 +292,21 @@ procedure main() call malloc(); goto l00000307; l00000307: - assume {:captureState "addr:0x7e4"}true; + assume {:captureState "addr:l00000307"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x7e4"}true; + assume {:captureState "%0000030d"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R1, Gamma_R1 := 1bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x7f0"}true; + assume {:captureState "%00000321"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 2044bv64, true; call #free(); goto l00000332; l00000332: - assume {:captureState "addr:0x7fc"}true; + assume {:captureState "addr:l00000332"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; diff --git a/src/test/correct/basicfree/gcc_O2/basicfree.expected b/src/test/correct/basicfree/gcc_O2/basicfree.expected index cf806e8fd..9c7036705 100644 --- a/src/test/correct/basicfree/gcc_O2/basicfree.expected +++ b/src/test/correct/basicfree/gcc_O2/basicfree.expected @@ -1,12 +1,12 @@ -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }mem: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1896bv64); -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1896bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -47,7 +47,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,9 +56,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -152,6 +152,6 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; return; } diff --git a/src/test/correct/basicfree/gcc_no_plt_no_pic/basicfree.expected b/src/test/correct/basicfree/gcc_no_plt_no_pic/basicfree.expected index 220da675a..10bf388a9 100644 --- a/src/test/correct/basicfree/gcc_no_plt_no_pic/basicfree.expected +++ b/src/test/correct/basicfree/gcc_no_plt_no_pic/basicfree.expected @@ -1,57 +1,57 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2076bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2076bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,9 +101,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -279,12 +279,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x7d4"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x7d4"}true; + assume {:captureState "%000008bd"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x7d4"}true; + assume {:captureState "%000008c3"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 4bv64, true; @@ -292,21 +292,21 @@ procedure main() call malloc(); goto l000008dc; l000008dc: - assume {:captureState "addr:0x7e4"}true; + assume {:captureState "addr:l000008dc"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x7e4"}true; + assume {:captureState "%000008e2"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R1, Gamma_R1 := 1bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x7f0"}true; + assume {:captureState "%000008f6"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 2044bv64, true; call #free(); goto l00000907; l00000907: - assume {:captureState "addr:0x7fc"}true; + assume {:captureState "addr:l00000907"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; diff --git a/src/test/correct/basicfree/gcc_pic/basicfree.expected b/src/test/correct/basicfree/gcc_pic/basicfree.expected index 220da675a..10bf388a9 100644 --- a/src/test/correct/basicfree/gcc_pic/basicfree.expected +++ b/src/test/correct/basicfree/gcc_pic/basicfree.expected @@ -1,57 +1,57 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2076bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2076bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,9 +101,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -279,12 +279,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x7d4"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x7d4"}true; + assume {:captureState "%000008bd"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x7d4"}true; + assume {:captureState "%000008c3"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 4bv64, true; @@ -292,21 +292,21 @@ procedure main() call malloc(); goto l000008dc; l000008dc: - assume {:captureState "addr:0x7e4"}true; + assume {:captureState "addr:l000008dc"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x7e4"}true; + assume {:captureState "%000008e2"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R1, Gamma_R1 := 1bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x7f0"}true; + assume {:captureState "%000008f6"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 2044bv64, true; call #free(); goto l00000907; l00000907: - assume {:captureState "addr:0x7fc"}true; + assume {:captureState "addr:l00000907"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; diff --git a/src/test/correct/cjump/clang/cjump.expected b/src/test/correct/cjump/clang/cjump.expected index 03f893ccf..8e118cae7 100644 --- a/src/test/correct/cjump/clang/cjump.expected +++ b/src/test/correct/cjump/clang/cjump.expected @@ -1,54 +1,54 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,9 +98,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -209,16 +209,16 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000309"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%0000031b"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; @@ -245,28 +245,28 @@ procedure main() } goto l0000037e; l00000351: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:l00000351"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 2bv64, true; call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%00000366"} true; goto l00000369; l0000037e: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l0000037e"} true; goto l0000037f; l0000037f: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l0000037f"} true; R8, Gamma_R8 := 3bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); - assume {:captureState "addr:0x744"}true; + assume {:captureState "%00000392"} true; goto l00000369; l00000369: - assume {:captureState "addr:0x75c"}true; + assume {:captureState "addr:l00000369"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/cjump/clang_O2/cjump.expected b/src/test/correct/cjump/clang_O2/cjump.expected index b975a33e5..34ba4ea5d 100644 --- a/src/test/correct/cjump/clang_O2/cjump.expected +++ b/src/test/correct/cjump/clang_O2/cjump.expected @@ -1,41 +1,41 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R11: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R11: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R11: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R11: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,9 +85,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -184,7 +184,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; @@ -193,10 +193,10 @@ procedure main() call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%000002e9"} true; call rely(); assert (L(mem, bvadd64(R10, 56bv64)) ==> Gamma_R11); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R10, 56bv64), R11[32:0]), gamma_store32(Gamma_mem, bvadd64(R10, 56bv64), Gamma_R11); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%000002f1"} true; return; } diff --git a/src/test/correct/cjump/clang_no_plt_no_pic/cjump.expected b/src/test/correct/cjump/clang_no_plt_no_pic/cjump.expected index 0ab319383..facdc706e 100644 --- a/src/test/correct/cjump/clang_no_plt_no_pic/cjump.expected +++ b/src/test/correct/cjump/clang_no_plt_no_pic/cjump.expected @@ -1,54 +1,54 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,9 +98,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -209,16 +209,16 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%0000095f"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000971"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; @@ -245,28 +245,28 @@ procedure main() } goto l000009d4; l000009a7: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:l000009a7"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 2bv64, true; call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000009bc"} true; goto l000009bf; l000009d4: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l000009d4"} true; goto l000009d5; l000009d5: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l000009d5"} true; R8, Gamma_R8 := 3bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); - assume {:captureState "addr:0x744"}true; + assume {:captureState "%000009e8"} true; goto l000009bf; l000009bf: - assume {:captureState "addr:0x75c"}true; + assume {:captureState "addr:l000009bf"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/cjump/clang_pic/cjump.expected b/src/test/correct/cjump/clang_pic/cjump.expected index 37fb79cb2..e166fd0e8 100644 --- a/src/test/correct/cjump/clang_pic/cjump.expected +++ b/src/test/correct/cjump/clang_pic/cjump.expected @@ -1,62 +1,62 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -113,7 +113,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -122,9 +122,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -265,10 +265,10 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000315"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -276,7 +276,7 @@ procedure main() call rely(); assert (L(mem, R8) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, R8, R9[32:0]), gamma_store32(Gamma_mem, R8, Gamma_R9); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%0000032e"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; @@ -303,7 +303,7 @@ procedure main() } goto l00000398; l00000364: - assume {:captureState "addr:0x794"}true; + assume {:captureState "addr:l00000364"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4048bv64)) || L(mem, bvadd64(R9, 4048bv64))); @@ -311,13 +311,13 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x7a0"}true; + assume {:captureState "%00000380"} true; goto l00000383; l00000398: - assume {:captureState "addr:0x77c"}true; + assume {:captureState "addr:l00000398"} true; goto l00000399; l00000399: - assume {:captureState "addr:0x780"}true; + assume {:captureState "addr:l00000399"} true; R8, Gamma_R8 := 3bv64, true; R9, Gamma_R9 := 65536bv64, true; call rely(); @@ -325,10 +325,10 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x78c"}true; + assume {:captureState "%000003b3"} true; goto l00000383; l00000383: - assume {:captureState "addr:0x7a8"}true; + assume {:captureState "addr:l00000383"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/cjump/gcc/cjump.expected b/src/test/correct/cjump/gcc/cjump.expected index 8944ce29e..285553345 100644 --- a/src/test/correct/cjump/gcc/cjump.expected +++ b/src/test/correct/cjump/gcc/cjump.expected @@ -1,48 +1,48 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,7 +83,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,9 +92,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -201,14 +201,14 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000310"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -224,27 +224,27 @@ procedure main() } goto l00000365; l0000033e: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:l0000033e"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 2bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000359"} true; goto l0000035b; l00000365: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l00000365"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 3bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x744"}true; + assume {:captureState "%0000037b"} true; goto l0000035b; l0000035b: - assume {:captureState "addr:0x75c"}true; + assume {:captureState "addr:l0000035b"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/cjump/gcc_O2/cjump.expected b/src/test/correct/cjump/gcc_O2/cjump.expected index d28e04d56..50db70672 100644 --- a/src/test/correct/cjump/gcc_O2/cjump.expected +++ b/src/test/correct/cjump/gcc_O2/cjump.expected @@ -1,39 +1,39 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R3: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }R3: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R3: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R3: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -74,7 +74,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,9 +83,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R0, 20bv64), Gamma_R0; R3, Gamma_R3 := 1bv64, true; @@ -190,11 +190,11 @@ procedure main() call rely(); assert (L(mem, bvadd64(R0, 20bv64)) ==> Gamma_R3); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R0, 20bv64), R3[32:0]), gamma_store32(Gamma_mem, bvadd64(R0, 20bv64), Gamma_R3); - assume {:captureState "addr:0x610"}true; + assume {:captureState "%000001c3"} true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R1, 4bv64)) ==> Gamma_R2); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 4bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 4bv64), Gamma_R2); - assume {:captureState "addr:0x618"}true; + assume {:captureState "%000001d0"} true; return; } diff --git a/src/test/correct/cjump/gcc_no_plt_no_pic/cjump.expected b/src/test/correct/cjump/gcc_no_plt_no_pic/cjump.expected index 34a1bd1d7..8cd715879 100644 --- a/src/test/correct/cjump/gcc_no_plt_no_pic/cjump.expected +++ b/src/test/correct/cjump/gcc_no_plt_no_pic/cjump.expected @@ -1,48 +1,48 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,7 +83,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,9 +92,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -201,14 +201,14 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%0000094e"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -224,27 +224,27 @@ procedure main() } goto l000009a3; l0000097c: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:l0000097c"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 2bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000997"} true; goto l00000999; l000009a3: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l000009a3"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 3bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x744"}true; + assume {:captureState "%000009b9"} true; goto l00000999; l00000999: - assume {:captureState "addr:0x75c"}true; + assume {:captureState "addr:l00000999"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/cjump/gcc_pic/cjump.expected b/src/test/correct/cjump/gcc_pic/cjump.expected index 63ccf118d..b18dd05e0 100644 --- a/src/test/correct/cjump/gcc_pic/cjump.expected +++ b/src/test/correct/cjump/gcc_pic/cjump.expected @@ -1,56 +1,56 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -107,7 +107,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -116,9 +116,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -257,7 +257,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -265,7 +265,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%00000311"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -282,7 +282,7 @@ procedure main() } goto l00000368; l00000340: - assume {:captureState "addr:0x78c"}true; + assume {:captureState "addr:l00000340"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -290,10 +290,10 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x798"}true; + assume {:captureState "%0000035c"} true; goto l0000035e; l00000368: - assume {:captureState "addr:0x778"}true; + assume {:captureState "addr:l00000368"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -301,10 +301,10 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%0000037f"} true; goto l0000035e; l0000035e: - assume {:captureState "addr:0x79c"}true; + assume {:captureState "addr:l0000035e"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/function/clang/function.expected b/src/test/correct/function/clang/function.expected index afdf8432e..398b77936 100644 --- a/src/test/correct/function/clang/function.expected +++ b/src/test/correct/function/clang/function.expected @@ -1,61 +1,61 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,7 +96,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -105,9 +105,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -187,7 +187,7 @@ procedure get_two() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lget_two: - assume {:captureState "addr:0x740"}true; + assume {:captureState "addr:lget_two"} true; R0, Gamma_R0 := 2bv64, true; return; } @@ -292,12 +292,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x714"}true; + assume {:captureState "%000008db"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x714"}true; + assume {:captureState "%000008e1"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R9, Gamma_R9 := 69632bv64, true; @@ -305,17 +305,17 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000008fd"} true; R30, Gamma_R30 := 1836bv64, true; call get_two(); goto l00000910; l00000910: - assume {:captureState "addr:0x72c"}true; + assume {:captureState "addr:l00000910"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), Gamma_R0); - assume {:captureState "addr:0x730"}true; + assume {:captureState "%0000091b"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function/clang_O2/function.expected b/src/test/correct/function/clang_O2/function.expected index 139696a65..352903a5b 100644 --- a/src/test/correct/function/clang_O2/function.expected +++ b/src/test/correct/function/clang_O2/function.expected @@ -1,41 +1,41 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R11: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R11: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R11: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R11: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,9 +85,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -184,7 +184,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; @@ -193,10 +193,10 @@ procedure main() call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%000002f1"} true; call rely(); assert (L(mem, bvadd64(R10, 56bv64)) ==> Gamma_R11); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R10, 56bv64), R11[32:0]), gamma_store32(Gamma_mem, bvadd64(R10, 56bv64), Gamma_R11); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%000002f9"} true; return; } diff --git a/src/test/correct/function/clang_no_plt_no_pic/function.expected b/src/test/correct/function/clang_no_plt_no_pic/function.expected index afdf8432e..398b77936 100644 --- a/src/test/correct/function/clang_no_plt_no_pic/function.expected +++ b/src/test/correct/function/clang_no_plt_no_pic/function.expected @@ -1,61 +1,61 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,7 +96,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -105,9 +105,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -187,7 +187,7 @@ procedure get_two() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lget_two: - assume {:captureState "addr:0x740"}true; + assume {:captureState "addr:lget_two"} true; R0, Gamma_R0 := 2bv64, true; return; } @@ -292,12 +292,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x714"}true; + assume {:captureState "%000008db"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x714"}true; + assume {:captureState "%000008e1"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R9, Gamma_R9 := 69632bv64, true; @@ -305,17 +305,17 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000008fd"} true; R30, Gamma_R30 := 1836bv64, true; call get_two(); goto l00000910; l00000910: - assume {:captureState "addr:0x72c"}true; + assume {:captureState "addr:l00000910"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), Gamma_R0); - assume {:captureState "addr:0x730"}true; + assume {:captureState "%0000091b"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function/clang_pic/function.expected b/src/test/correct/function/clang_pic/function.expected index 15b648d0a..ba84e8c55 100644 --- a/src/test/correct/function/clang_pic/function.expected +++ b/src/test/correct/function/clang_pic/function.expected @@ -1,61 +1,61 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -112,7 +112,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -121,9 +121,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -235,7 +235,7 @@ procedure get_two() free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { lget_two: - assume {:captureState "addr:0x788"}true; + assume {:captureState "addr:lget_two"} true; R0, Gamma_R0 := 2bv64, true; return; } @@ -372,12 +372,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000002f0"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000002f6"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R9, Gamma_R9 := 65536bv64, true; @@ -387,19 +387,19 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%00000319"} true; R30, Gamma_R30 := 1904bv64, true; call get_two(); goto l0000032c; l0000032c: - assume {:captureState "addr:0x770"}true; + assume {:captureState "addr:l0000032c"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4048bv64)) || L(mem, bvadd64(R8, 4048bv64))); call rely(); assert (L(mem, R8) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, R8, R0[32:0]), gamma_store32(Gamma_mem, R8, Gamma_R0); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%0000033e"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function/gcc/function.expected b/src/test/correct/function/gcc/function.expected index 951db16a2..7d4e83549 100644 --- a/src/test/correct/function/gcc/function.expected +++ b/src/test/correct/function/gcc/function.expected @@ -1,60 +1,60 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -95,7 +95,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -104,9 +104,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -186,7 +186,7 @@ procedure get_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lget_two: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:lget_two"} true; R0, Gamma_R0 := 2bv64, true; return; } @@ -291,12 +291,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x714"}true; + assume {:captureState "%0000090b"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x714"}true; + assume {:captureState "%00000911"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 69632bv64, true; @@ -305,19 +305,19 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000933"} true; R30, Gamma_R30 := 1840bv64, true; call get_two(); goto l00000946; l00000946: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l00000946"} true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%0000095d"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function/gcc_O2/function.expected b/src/test/correct/function/gcc_O2/function.expected index e26bc9c95..d08cc3d3b 100644 --- a/src/test/correct/function/gcc_O2/function.expected +++ b/src/test/correct/function/gcc_O2/function.expected @@ -1,39 +1,39 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R3: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }R3: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R3: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R3: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -74,7 +74,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,9 +83,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R0, 20bv64), Gamma_R0; R3, Gamma_R3 := 1bv64, true; @@ -190,11 +190,11 @@ procedure main() call rely(); assert (L(mem, bvadd64(R0, 20bv64)) ==> Gamma_R3); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R0, 20bv64), R3[32:0]), gamma_store32(Gamma_mem, bvadd64(R0, 20bv64), Gamma_R3); - assume {:captureState "addr:0x610"}true; + assume {:captureState "%000001d7"} true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R1, 4bv64)) ==> Gamma_R2); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 4bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 4bv64), Gamma_R2); - assume {:captureState "addr:0x618"}true; + assume {:captureState "%000001e4"} true; return; } diff --git a/src/test/correct/function/gcc_no_plt_no_pic/function.expected b/src/test/correct/function/gcc_no_plt_no_pic/function.expected index 951db16a2..7d4e83549 100644 --- a/src/test/correct/function/gcc_no_plt_no_pic/function.expected +++ b/src/test/correct/function/gcc_no_plt_no_pic/function.expected @@ -1,60 +1,60 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -95,7 +95,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -104,9 +104,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -186,7 +186,7 @@ procedure get_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lget_two: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:lget_two"} true; R0, Gamma_R0 := 2bv64, true; return; } @@ -291,12 +291,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x714"}true; + assume {:captureState "%0000090b"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x714"}true; + assume {:captureState "%00000911"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 69632bv64, true; @@ -305,19 +305,19 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000933"} true; R30, Gamma_R30 := 1840bv64, true; call get_two(); goto l00000946; l00000946: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l00000946"} true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%0000095d"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function/gcc_pic/function.expected b/src/test/correct/function/gcc_pic/function.expected index b3b5058bf..e53787b44 100644 --- a/src/test/correct/function/gcc_pic/function.expected +++ b/src/test/correct/function/gcc_pic/function.expected @@ -1,60 +1,60 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -111,7 +111,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -120,9 +120,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -234,7 +234,7 @@ procedure get_two() free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { lget_two: - assume {:captureState "addr:0x78c"}true; + assume {:captureState "addr:lget_two"} true; R0, Gamma_R0 := 2bv64, true; return; } @@ -371,12 +371,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000002f4"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000002fa"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 65536bv64, true; @@ -386,12 +386,12 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%0000031d"} true; R30, Gamma_R30 := 1904bv64, true; call get_two(); goto l00000330; l00000330: - assume {:captureState "addr:0x770"}true; + assume {:captureState "addr:l00000330"} true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -399,7 +399,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x77c"}true; + assume {:captureState "%00000348"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function1/clang/function1.expected b/src/test/correct/function1/clang/function1.expected index 0c2443f8d..0add677c0 100644 --- a/src/test/correct/function1/clang/function1.expected +++ b/src/test/correct/function1/clang/function1.expected @@ -1,91 +1,91 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R2: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2024bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69692bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69696bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2024bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69692bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69696bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "sign_extend 32"}sign_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 32"} sign_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -130,7 +130,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -139,9 +139,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -230,14 +230,14 @@ procedure get_two() free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { lget_two: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lget_two"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000336"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R1[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R1); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%0000033e"} true; stack, Gamma_stack := memory_store64_le(stack, R31, R2), gamma_store64(Gamma_stack, R31, Gamma_R2); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%00000346"} true; R8, Gamma_R8 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R9, Gamma_R9 := zero_extend32_32(bvadd32(R8[32:0], R9[32:0])), (Gamma_R9 && Gamma_R8); @@ -354,12 +354,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x784"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%00000386"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%0000038c"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R9, Gamma_R9 := 69632bv64, true; @@ -367,7 +367,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 60bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 60bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 60bv64), Gamma_R8); - assume {:captureState "addr:0x794"}true; + assume {:captureState "%000003a8"} true; R0, Gamma_R0 := 97bv64, true; R1, Gamma_R1 := 10bv64, true; R2, Gamma_R2 := 58368bv64, true; @@ -377,12 +377,12 @@ procedure main() call get_two(); goto l000003ce; l000003ce: - assume {:captureState "addr:0x7b0"}true; + assume {:captureState "addr:l000003ce"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 64bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 64bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 64bv64), Gamma_R0); - assume {:captureState "addr:0x7b4"}true; + assume {:captureState "%000003d9"} true; call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 64bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 64bv64)) || L(mem, bvadd64(R8, 64bv64))); R0, Gamma_R0 := 0bv64, true; @@ -391,7 +391,7 @@ procedure main() call printf(); goto l000003f5; l000003f5: - assume {:captureState "addr:0x7c8"}true; + assume {:captureState "addr:l000003f5"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function1/clang_O2/function1.expected b/src/test/correct/function1/clang_O2/function1.expected index 4bc9567ef..74f09f520 100644 --- a/src/test/correct/function1/clang_O2/function1.expected +++ b/src/test/correct/function1/clang_O2/function1.expected @@ -1,70 +1,70 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R11: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R10: bv64; -var {:extern }R11: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1976bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69692bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69696bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R11: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R10: bv64; +var {:extern } R11: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1976bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69692bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69696bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,7 +109,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -118,9 +118,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -229,12 +229,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x760"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%00000317"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%0000031d"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R11, Gamma_R11 := 58475bv64, true; @@ -249,16 +249,16 @@ procedure main() call rely(); assert (L(mem, bvadd64(R8, 60bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 60bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 60bv64), Gamma_R9); - assume {:captureState "addr:0x78c"}true; + assume {:captureState "%0000035f"} true; call rely(); assert (L(mem, bvadd64(R10, 64bv64)) ==> Gamma_R11); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R10, 64bv64), R11[32:0]), gamma_store32(Gamma_mem, bvadd64(R10, 64bv64), Gamma_R11); - assume {:captureState "addr:0x790"}true; + assume {:captureState "%00000367"} true; R30, Gamma_R30 := 1944bv64, true; call printf(); goto l00000371; l00000371: - assume {:captureState "addr:0x798"}true; + assume {:captureState "addr:l00000371"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function1/clang_no_plt_no_pic/function1.expected b/src/test/correct/function1/clang_no_plt_no_pic/function1.expected index c3e2bcfc6..5b4c159e3 100644 --- a/src/test/correct/function1/clang_no_plt_no_pic/function1.expected +++ b/src/test/correct/function1/clang_no_plt_no_pic/function1.expected @@ -1,91 +1,91 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R2: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2024bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69692bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69696bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2024bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69692bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69696bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "sign_extend 32"}sign_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 32"} sign_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -130,7 +130,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -139,9 +139,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -230,14 +230,14 @@ procedure get_two() free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { lget_two: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lget_two"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000a47"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R1[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R1); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%00000a4f"} true; stack, Gamma_stack := memory_store64_le(stack, R31, R2), gamma_store64(Gamma_stack, R31, Gamma_R2); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%00000a57"} true; R8, Gamma_R8 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R9, Gamma_R9 := zero_extend32_32(bvadd32(R8[32:0], R9[32:0])), (Gamma_R9 && Gamma_R8); @@ -354,12 +354,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x784"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%00000a97"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%00000a9d"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R9, Gamma_R9 := 69632bv64, true; @@ -367,7 +367,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 60bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 60bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 60bv64), Gamma_R8); - assume {:captureState "addr:0x794"}true; + assume {:captureState "%00000ab9"} true; R0, Gamma_R0 := 97bv64, true; R1, Gamma_R1 := 10bv64, true; R2, Gamma_R2 := 58368bv64, true; @@ -377,12 +377,12 @@ procedure main() call get_two(); goto l00000adf; l00000adf: - assume {:captureState "addr:0x7b0"}true; + assume {:captureState "addr:l00000adf"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 64bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 64bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 64bv64), Gamma_R0); - assume {:captureState "addr:0x7b4"}true; + assume {:captureState "%00000aea"} true; call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 64bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 64bv64)) || L(mem, bvadd64(R8, 64bv64))); R0, Gamma_R0 := 0bv64, true; @@ -391,7 +391,7 @@ procedure main() call printf(); goto l00000b06; l00000b06: - assume {:captureState "addr:0x7c8"}true; + assume {:captureState "addr:l00000b06"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function1/clang_pic/function1.expected b/src/test/correct/function1/clang_pic/function1.expected index 2b0501aad..b44421cc6 100644 --- a/src/test/correct/function1/clang_pic/function1.expected +++ b/src/test/correct/function1/clang_pic/function1.expected @@ -1,91 +1,91 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R2: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2096bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69692bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69696bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2096bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69692bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69696bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "sign_extend 32"}sign_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 32"} sign_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -146,7 +146,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69590bv64) == 0bv8); free ensures (memory_load8_le(mem, 69591bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -155,9 +155,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -278,14 +278,14 @@ procedure get_two() free ensures (memory_load8_le(mem, 69591bv64) == 0bv8); { lget_two: - assume {:captureState "addr:0x794"}true; + assume {:captureState "addr:lget_two"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); - assume {:captureState "addr:0x798"}true; + assume {:captureState "%0000033e"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R1[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R1); - assume {:captureState "addr:0x79c"}true; + assume {:captureState "%00000346"} true; stack, Gamma_stack := memory_store64_le(stack, R31, R2), gamma_store64(Gamma_stack, R31, Gamma_R2); - assume {:captureState "addr:0x7a0"}true; + assume {:captureState "%0000034e"} true; R8, Gamma_R8 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R9, Gamma_R9 := zero_extend32_32(bvadd32(R8[32:0], R9[32:0])), (Gamma_R9 && Gamma_R8); @@ -434,12 +434,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x7c4"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x7c4"}true; + assume {:captureState "%0000038e"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x7c4"}true; + assume {:captureState "%00000394"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R9, Gamma_R9 := 65536bv64, true; @@ -449,7 +449,7 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x7d8"}true; + assume {:captureState "%000003b7"} true; R0, Gamma_R0 := 97bv64, true; R1, Gamma_R1 := 10bv64, true; R2, Gamma_R2 := 58368bv64, true; @@ -459,14 +459,14 @@ procedure main() call get_two(); goto l000003dd; l000003dd: - assume {:captureState "addr:0x7f4"}true; + assume {:captureState "addr:l000003dd"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4048bv64)) || L(mem, bvadd64(R8, 4048bv64))); call rely(); assert (L(mem, R8) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, R8, R0[32:0]), gamma_store32(Gamma_mem, R8, Gamma_R0); - assume {:captureState "addr:0x7fc"}true; + assume {:captureState "%000003ef"} true; call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); R0, Gamma_R0 := 0bv64, true; @@ -475,7 +475,7 @@ procedure main() call printf(); goto l0000040b; l0000040b: - assume {:captureState "addr:0x810"}true; + assume {:captureState "addr:l0000040b"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function1/gcc/function1.expected b/src/test/correct/function1/gcc/function1.expected index 4d0681d0c..4f9f2bc7c 100644 --- a/src/test/correct/function1/gcc/function1.expected +++ b/src/test/correct/function1/gcc/function1.expected @@ -1,86 +1,86 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R2: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2048bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2048bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -129,7 +129,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -138,9 +138,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -237,14 +237,14 @@ procedure get_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lget_two: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lget_two"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%0000034e"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R1[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R1); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%00000356"} true; stack, Gamma_stack := memory_store64_le(stack, R31, R2), gamma_store64(Gamma_stack, R31, Gamma_R2); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%0000035e"} true; R1, Gamma_R1 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R1[32:0], R0[32:0])), (Gamma_R0 && Gamma_R1); @@ -369,12 +369,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x784"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%0000039e"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%000003a4"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 69632bv64, true; @@ -383,7 +383,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x798"}true; + assume {:captureState "%000003c6"} true; R2, Gamma_R2 := 58368bv64, true; R2, Gamma_R2 := (R2[64:32] ++ (21515bv16 ++ R2[16:0])), Gamma_R2; R2, Gamma_R2 := (R2[64:48] ++ (2bv16 ++ R2[32:0])), Gamma_R2; @@ -393,14 +393,14 @@ procedure main() call get_two(); goto l000003ec; l000003ec: - assume {:captureState "addr:0x7b4"}true; + assume {:captureState "addr:l000003ec"} true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x7c0"}true; + assume {:captureState "%00000403"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -412,7 +412,7 @@ procedure main() call printf(); goto l00000430; l00000430: - assume {:captureState "addr:0x7e0"}true; + assume {:captureState "addr:l00000430"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function1/gcc_O2/function1.expected b/src/test/correct/function1/gcc_O2/function1.expected index 64d3bc49f..2e492384e 100644 --- a/src/test/correct/function1/gcc_O2/function1.expected +++ b/src/test/correct/function1/gcc_O2/function1.expected @@ -1,66 +1,66 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R3: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R2: bv64; -var {:extern }R29: bv64; -var {:extern }R3: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2048bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R3: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R3: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2048bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,7 +109,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -118,9 +118,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure __printf_chk(); @@ -328,12 +328,12 @@ procedure main() var #1: bv64; var Gamma_#1: bool; lmain: - assume {:captureState "addr:0x680"}true; + assume {:captureState "addr:lmain"} true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); - assume {:captureState "addr:0x680"}true; + assume {:captureState "%000001ca"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#1, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#1, 8bv64), Gamma_R30); - assume {:captureState "addr:0x680"}true; + assume {:captureState "%000001d0"} true; R31, Gamma_R31 := #1, Gamma_#1; R1, Gamma_R1 := 69632bv64, true; R3, Gamma_R3 := bvadd64(R1, 20bv64), Gamma_R1; @@ -344,18 +344,18 @@ procedure main() call rely(); assert (L(mem, bvadd64(R1, 20bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R0); - assume {:captureState "addr:0x69c"}true; + assume {:captureState "%000001fd"} true; R1, Gamma_R1 := 0bv64, true; R1, Gamma_R1 := bvadd64(R1, 2056bv64), Gamma_R1; call rely(); assert (L(mem, bvadd64(R3, 4bv64)) ==> Gamma_R2); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R3, 4bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R3, 4bv64), Gamma_R2); - assume {:captureState "addr:0x6a8"}true; + assume {:captureState "%00000210"} true; R30, Gamma_R30 := 1712bv64, true; call __printf_chk(); goto l0000021a; l0000021a: - assume {:captureState "addr:0x6b0"}true; + assume {:captureState "addr:l0000021a"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function1/gcc_no_plt_no_pic/function1.expected b/src/test/correct/function1/gcc_no_plt_no_pic/function1.expected index 8ae339712..1a5d7358f 100644 --- a/src/test/correct/function1/gcc_no_plt_no_pic/function1.expected +++ b/src/test/correct/function1/gcc_no_plt_no_pic/function1.expected @@ -1,86 +1,86 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R2: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2048bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2048bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -129,7 +129,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -138,9 +138,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -237,14 +237,14 @@ procedure get_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lget_two: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lget_two"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000aa6"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R1[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R1); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%00000aae"} true; stack, Gamma_stack := memory_store64_le(stack, R31, R2), gamma_store64(Gamma_stack, R31, Gamma_R2); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%00000ab6"} true; R1, Gamma_R1 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R1[32:0], R0[32:0])), (Gamma_R0 && Gamma_R1); @@ -369,12 +369,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x784"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%00000af6"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%00000afc"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 69632bv64, true; @@ -383,7 +383,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x798"}true; + assume {:captureState "%00000b1e"} true; R2, Gamma_R2 := 58368bv64, true; R2, Gamma_R2 := (R2[64:32] ++ (21515bv16 ++ R2[16:0])), Gamma_R2; R2, Gamma_R2 := (R2[64:48] ++ (2bv16 ++ R2[32:0])), Gamma_R2; @@ -393,14 +393,14 @@ procedure main() call get_two(); goto l00000b44; l00000b44: - assume {:captureState "addr:0x7b4"}true; + assume {:captureState "addr:l00000b44"} true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x7c0"}true; + assume {:captureState "%00000b5b"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -412,7 +412,7 @@ procedure main() call printf(); goto l00000b88; l00000b88: - assume {:captureState "addr:0x7e0"}true; + assume {:captureState "addr:l00000b88"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function1/gcc_pic/function1.expected b/src/test/correct/function1/gcc_pic/function1.expected index 07a8d8148..25885ad0b 100644 --- a/src/test/correct/function1/gcc_pic/function1.expected +++ b/src/test/correct/function1/gcc_pic/function1.expected @@ -1,86 +1,86 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R2: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2112bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2112bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -145,7 +145,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -154,9 +154,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -285,14 +285,14 @@ procedure get_two() free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); { lget_two: - assume {:captureState "addr:0x794"}true; + assume {:captureState "addr:lget_two"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); - assume {:captureState "addr:0x798"}true; + assume {:captureState "%0000034e"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R1[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R1); - assume {:captureState "addr:0x79c"}true; + assume {:captureState "%00000356"} true; stack, Gamma_stack := memory_store64_le(stack, R31, R2), gamma_store64(Gamma_stack, R31, Gamma_R2); - assume {:captureState "addr:0x7a0"}true; + assume {:captureState "%0000035e"} true; R1, Gamma_R1 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R1[32:0], R0[32:0])), (Gamma_R0 && Gamma_R1); @@ -449,12 +449,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x7c4"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x7c4"}true; + assume {:captureState "%0000039e"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x7c4"}true; + assume {:captureState "%000003a4"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 65536bv64, true; @@ -464,7 +464,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x7d8"}true; + assume {:captureState "%000003c7"} true; R2, Gamma_R2 := 58368bv64, true; R2, Gamma_R2 := (R2[64:32] ++ (21515bv16 ++ R2[16:0])), Gamma_R2; R2, Gamma_R2 := (R2[64:48] ++ (2bv16 ++ R2[32:0])), Gamma_R2; @@ -474,7 +474,7 @@ procedure main() call get_two(); goto l000003ed; l000003ed: - assume {:captureState "addr:0x7f4"}true; + assume {:captureState "addr:l000003ed"} true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -482,7 +482,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x800"}true; + assume {:captureState "%00000405"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -495,7 +495,7 @@ procedure main() call printf(); goto l00000433; l00000433: - assume {:captureState "addr:0x820"}true; + assume {:captureState "addr:l00000433"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/functions_with_params/clang/functions_with_params.expected b/src/test/correct/functions_with_params/clang/functions_with_params.expected index a1321a395..dc31bec22 100644 --- a/src/test/correct/functions_with_params/clang/functions_with_params.expected +++ b/src/test/correct/functions_with_params/clang/functions_with_params.expected @@ -1,59 +1,59 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1912bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1912bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,9 +103,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -208,28 +208,28 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%0000030a"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000310"} true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000323"} true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%00000330"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R29, 18446744073709551612bv64))), gamma_load32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64)); R30, Gamma_R30 := 1848bv64, true; call plus_one(); goto l00000366; l00000366: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l00000366"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R0); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%0000036c"} true; R0, Gamma_R0 := 0bv64, true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -316,10 +316,10 @@ procedure plus_one() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lplus_one: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:lplus_one"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x750"}true; + assume {:captureState "%0000034c"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; diff --git a/src/test/correct/functions_with_params/clang_O2/functions_with_params.expected b/src/test/correct/functions_with_params/clang_O2/functions_with_params.expected index bbebaae99..0c551beb5 100644 --- a/src/test/correct/functions_with_params/clang_O2/functions_with_params.expected +++ b/src/test/correct/functions_with_params/clang_O2/functions_with_params.expected @@ -1,14 +1,14 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1848bv64); -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1848bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/functions_with_params/clang_no_plt_no_pic/functions_with_params.expected b/src/test/correct/functions_with_params/clang_no_plt_no_pic/functions_with_params.expected index df53564d3..cc5c96c31 100644 --- a/src/test/correct/functions_with_params/clang_no_plt_no_pic/functions_with_params.expected +++ b/src/test/correct/functions_with_params/clang_no_plt_no_pic/functions_with_params.expected @@ -1,59 +1,59 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1912bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1912bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,9 +103,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -208,28 +208,28 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000955"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%0000095b"} true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%0000096e"} true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%0000097b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R29, 18446744073709551612bv64))), gamma_load32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64)); R30, Gamma_R30 := 1848bv64, true; call plus_one(); goto l000009b1; l000009b1: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l000009b1"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R0); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%000009b7"} true; R0, Gamma_R0 := 0bv64, true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -316,10 +316,10 @@ procedure plus_one() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lplus_one: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:lplus_one"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x750"}true; + assume {:captureState "%00000997"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; diff --git a/src/test/correct/functions_with_params/clang_pic/functions_with_params.expected b/src/test/correct/functions_with_params/clang_pic/functions_with_params.expected index df53564d3..cc5c96c31 100644 --- a/src/test/correct/functions_with_params/clang_pic/functions_with_params.expected +++ b/src/test/correct/functions_with_params/clang_pic/functions_with_params.expected @@ -1,59 +1,59 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1912bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1912bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,9 +103,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -208,28 +208,28 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000955"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%0000095b"} true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%0000096e"} true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%0000097b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R29, 18446744073709551612bv64))), gamma_load32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64)); R30, Gamma_R30 := 1848bv64, true; call plus_one(); goto l000009b1; l000009b1: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l000009b1"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R0); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%000009b7"} true; R0, Gamma_R0 := 0bv64, true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); @@ -316,10 +316,10 @@ procedure plus_one() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lplus_one: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:lplus_one"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x750"}true; + assume {:captureState "%00000997"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; diff --git a/src/test/correct/functions_with_params/gcc/functions_with_params.expected b/src/test/correct/functions_with_params/gcc/functions_with_params.expected index 22c8d80c9..e727d786d 100644 --- a/src/test/correct/functions_with_params/gcc/functions_with_params.expected +++ b/src/test/correct/functions_with_params/gcc/functions_with_params.expected @@ -1,57 +1,57 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1904bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1904bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,9 +101,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -204,28 +204,28 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x714"}true; + assume {:captureState "%000002fc"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x714"}true; + assume {:captureState "%00000302"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000319"} true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000326"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 1844bv64, true; call plus_one(); goto l0000035c; l0000035c: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l0000035c"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%00000362"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -311,10 +311,10 @@ procedure plus_one() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lplus_one: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:lplus_one"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000342"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 1bv32)), Gamma_R0; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; diff --git a/src/test/correct/functions_with_params/gcc_O2/functions_with_params.expected b/src/test/correct/functions_with_params/gcc_O2/functions_with_params.expected index 4fa6efe6f..b838106e7 100644 --- a/src/test/correct/functions_with_params/gcc_O2/functions_with_params.expected +++ b/src/test/correct/functions_with_params/gcc_O2/functions_with_params.expected @@ -1,14 +1,14 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1916bv64); -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1916bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/functions_with_params/gcc_no_plt_no_pic/functions_with_params.expected b/src/test/correct/functions_with_params/gcc_no_plt_no_pic/functions_with_params.expected index aadc1fe40..b149ec3d5 100644 --- a/src/test/correct/functions_with_params/gcc_no_plt_no_pic/functions_with_params.expected +++ b/src/test/correct/functions_with_params/gcc_no_plt_no_pic/functions_with_params.expected @@ -1,57 +1,57 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1904bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1904bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,9 +101,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -204,28 +204,28 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x714"}true; + assume {:captureState "%00000933"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x714"}true; + assume {:captureState "%00000939"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000950"} true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%0000095d"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 1844bv64, true; call plus_one(); goto l00000993; l00000993: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l00000993"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%00000999"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -311,10 +311,10 @@ procedure plus_one() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lplus_one: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:lplus_one"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000979"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 1bv32)), Gamma_R0; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; diff --git a/src/test/correct/functions_with_params/gcc_pic/functions_with_params.expected b/src/test/correct/functions_with_params/gcc_pic/functions_with_params.expected index aadc1fe40..b149ec3d5 100644 --- a/src/test/correct/functions_with_params/gcc_pic/functions_with_params.expected +++ b/src/test/correct/functions_with_params/gcc_pic/functions_with_params.expected @@ -1,57 +1,57 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1904bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1904bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,9 +101,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -204,28 +204,28 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x714"}true; + assume {:captureState "%00000933"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x714"}true; + assume {:captureState "%00000939"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000950"} true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%0000095d"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 1844bv64, true; call plus_one(); goto l00000993; l00000993: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l00000993"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%00000999"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -311,10 +311,10 @@ procedure plus_one() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lplus_one: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:lplus_one"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000979"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 1bv32)), Gamma_R0; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; diff --git a/src/test/correct/ifbranches/clang/ifbranches.expected b/src/test/correct/ifbranches/clang/ifbranches.expected index dfe63d190..2c08802aa 100644 --- a/src/test/correct/ifbranches/clang/ifbranches.expected +++ b/src/test/correct/ifbranches/clang/ifbranches.expected @@ -1,54 +1,54 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,9 +98,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -208,16 +208,16 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%0000030d"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000315"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%0000031d"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000324"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 0bv33))), (Gamma_R8 && Gamma_#4); @@ -243,26 +243,26 @@ procedure main() } goto l00000397; l0000035a: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l0000035a"} true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x74c"}true; + assume {:captureState "%0000036a"} true; goto l0000036d; l00000397: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l00000397"} true; goto l00000398; l00000398: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000398"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%000003a6"} true; goto l0000036d; l0000036d: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:l0000036d"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%00000383"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/ifbranches/clang_O2/ifbranches.expected b/src/test/correct/ifbranches/clang_O2/ifbranches.expected index 9137eaa77..48ee466e2 100644 --- a/src/test/correct/ifbranches/clang_O2/ifbranches.expected +++ b/src/test/correct/ifbranches/clang_O2/ifbranches.expected @@ -1,23 +1,23 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,7 +58,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -67,9 +67,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -175,7 +175,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 2bv64, true; #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); diff --git a/src/test/correct/ifbranches/clang_no_plt_no_pic/ifbranches.expected b/src/test/correct/ifbranches/clang_no_plt_no_pic/ifbranches.expected index be2b089f5..e07f6572f 100644 --- a/src/test/correct/ifbranches/clang_no_plt_no_pic/ifbranches.expected +++ b/src/test/correct/ifbranches/clang_no_plt_no_pic/ifbranches.expected @@ -1,54 +1,54 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,9 +98,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -208,16 +208,16 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000979"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000981"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000989"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000990"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 0bv33))), (Gamma_R8 && Gamma_#4); @@ -243,26 +243,26 @@ procedure main() } goto l00000a03; l000009c6: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l000009c6"} true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x74c"}true; + assume {:captureState "%000009d6"} true; goto l000009d9; l00000a03: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l00000a03"} true; goto l00000a04; l00000a04: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000a04"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000a12"} true; goto l000009d9; l000009d9: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:l000009d9"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%000009ef"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/ifbranches/clang_pic/ifbranches.expected b/src/test/correct/ifbranches/clang_pic/ifbranches.expected index be2b089f5..e07f6572f 100644 --- a/src/test/correct/ifbranches/clang_pic/ifbranches.expected +++ b/src/test/correct/ifbranches/clang_pic/ifbranches.expected @@ -1,54 +1,54 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,9 +98,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -208,16 +208,16 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000979"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000981"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000989"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000990"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 0bv33))), (Gamma_R8 && Gamma_#4); @@ -243,26 +243,26 @@ procedure main() } goto l00000a03; l000009c6: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l000009c6"} true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x74c"}true; + assume {:captureState "%000009d6"} true; goto l000009d9; l00000a03: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l00000a03"} true; goto l00000a04; l00000a04: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000a04"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000a12"} true; goto l000009d9; l000009d9: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:l000009d9"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%000009ef"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/ifbranches/gcc/ifbranches.expected b/src/test/correct/ifbranches/gcc/ifbranches.expected index 9db490ac8..a81f98949 100644 --- a/src/test/correct/ifbranches/gcc/ifbranches.expected +++ b/src/test/correct/ifbranches/gcc/ifbranches.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,9 +96,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -206,14 +206,14 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000002fe"} true; stack, Gamma_stack := memory_store64_le(stack, R31, R1), gamma_store64(Gamma_stack, R31, Gamma_R1); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000306"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), true); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%0000030d"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -226,23 +226,23 @@ procedure main() } goto l00000369; l00000330: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000330"} true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000340"} true; goto l00000342; l00000369: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l00000369"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%00000374"} true; goto l00000342; l00000342: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:l00000342"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 1bv32)), Gamma_R0; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x74c"}true; + assume {:captureState "%00000355"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/ifbranches/gcc_O2/ifbranches.expected b/src/test/correct/ifbranches/gcc_O2/ifbranches.expected index fb26beabb..abe702918 100644 --- a/src/test/correct/ifbranches/gcc_O2/ifbranches.expected +++ b/src/test/correct/ifbranches/gcc_O2/ifbranches.expected @@ -1,21 +1,21 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }mem: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,7 +56,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -65,9 +65,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -173,7 +173,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; #1, Gamma_#1 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#1, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#1); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#1, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967296bv33))), (Gamma_R0 && Gamma_#1); diff --git a/src/test/correct/ifbranches/gcc_no_plt_no_pic/ifbranches.expected b/src/test/correct/ifbranches/gcc_no_plt_no_pic/ifbranches.expected index a94ff72dd..370e57676 100644 --- a/src/test/correct/ifbranches/gcc_no_plt_no_pic/ifbranches.expected +++ b/src/test/correct/ifbranches/gcc_no_plt_no_pic/ifbranches.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,9 +96,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -206,14 +206,14 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000931"} true; stack, Gamma_stack := memory_store64_le(stack, R31, R1), gamma_store64(Gamma_stack, R31, Gamma_R1); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000939"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), true); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000940"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -226,23 +226,23 @@ procedure main() } goto l0000099c; l00000963: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000963"} true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000973"} true; goto l00000975; l0000099c: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l0000099c"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%000009a7"} true; goto l00000975; l00000975: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:l00000975"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 1bv32)), Gamma_R0; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x74c"}true; + assume {:captureState "%00000988"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/ifbranches/gcc_pic/ifbranches.expected b/src/test/correct/ifbranches/gcc_pic/ifbranches.expected index a94ff72dd..370e57676 100644 --- a/src/test/correct/ifbranches/gcc_pic/ifbranches.expected +++ b/src/test/correct/ifbranches/gcc_pic/ifbranches.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,9 +96,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -206,14 +206,14 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000931"} true; stack, Gamma_stack := memory_store64_le(stack, R31, R1), gamma_store64(Gamma_stack, R31, Gamma_R1); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000939"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), true); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000940"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -226,23 +226,23 @@ procedure main() } goto l0000099c; l00000963: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000963"} true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000973"} true; goto l00000975; l0000099c: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l0000099c"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%000009a7"} true; goto l00000975; l00000975: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:l00000975"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 1bv32)), Gamma_R0; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x74c"}true; + assume {:captureState "%00000988"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/correct/ifglobal/clang/ifglobal.expected b/src/test/correct/ifglobal/clang/ifglobal.expected index 32a6b4719..c194aad54 100644 --- a/src/test/correct/ifglobal/clang/ifglobal.expected +++ b/src/test/correct/ifglobal/clang/ifglobal.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,9 +96,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -205,10 +205,10 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000002f1"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -236,19 +236,19 @@ procedure main() } goto l00000343; l00000343: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l00000343"} true; goto l00000344; l00000344: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l00000344"} true; R8, Gamma_R8 := 1bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%00000357"} true; goto l0000032c; l0000032c: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:l0000032c"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/ifglobal/clang_O2/ifglobal.expected b/src/test/correct/ifglobal/clang_O2/ifglobal.expected index b235ef11d..73ffd077a 100644 --- a/src/test/correct/ifglobal/clang_O2/ifglobal.expected +++ b/src/test/correct/ifglobal/clang_O2/ifglobal.expected @@ -1,41 +1,41 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,9 +85,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -192,16 +192,16 @@ procedure main() } goto l000002f8; l000002dc: - assume {:captureState "addr:0x728"}true; + assume {:captureState "addr:l000002dc"} true; R9, Gamma_R9 := 1bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%000002ec"} true; R0, Gamma_R0 := 0bv64, true; return; l000002f8: - assume {:captureState "addr:0x720"}true; + assume {:captureState "addr:l000002f8"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/ifglobal/clang_no_plt_no_pic/ifglobal.expected b/src/test/correct/ifglobal/clang_no_plt_no_pic/ifglobal.expected index bd525c686..e2441dabc 100644 --- a/src/test/correct/ifglobal/clang_no_plt_no_pic/ifglobal.expected +++ b/src/test/correct/ifglobal/clang_no_plt_no_pic/ifglobal.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,9 +96,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -205,10 +205,10 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000900"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -236,19 +236,19 @@ procedure main() } goto l00000952; l00000952: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l00000952"} true; goto l00000953; l00000953: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l00000953"} true; R8, Gamma_R8 := 1bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%00000966"} true; goto l0000093b; l0000093b: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:l0000093b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/ifglobal/clang_pic/ifglobal.expected b/src/test/correct/ifglobal/clang_pic/ifglobal.expected index 051cfdaf2..f939c757e 100644 --- a/src/test/correct/ifglobal/clang_pic/ifglobal.expected +++ b/src/test/correct/ifglobal/clang_pic/ifglobal.expected @@ -1,60 +1,60 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,7 +103,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -112,9 +112,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -237,10 +237,10 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%000002f9"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4040bv64)) || L(mem, bvadd64(R8, 4040bv64))); @@ -270,10 +270,10 @@ procedure main() } goto l00000352; l00000352: - assume {:captureState "addr:0x774"}true; + assume {:captureState "addr:l00000352"} true; goto l00000353; l00000353: - assume {:captureState "addr:0x778"}true; + assume {:captureState "addr:l00000353"} true; R8, Gamma_R8 := 1bv64, true; R9, Gamma_R9 := 65536bv64, true; call rely(); @@ -281,10 +281,10 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%0000036d"} true; goto l0000033b; l0000033b: - assume {:captureState "addr:0x78c"}true; + assume {:captureState "addr:l0000033b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/ifglobal/gcc/ifglobal.expected b/src/test/correct/ifglobal/gcc/ifglobal.expected index dcf9e5bd9..3cc4ec57f 100644 --- a/src/test/correct/ifglobal/gcc/ifglobal.expected +++ b/src/test/correct/ifglobal/gcc/ifglobal.expected @@ -1,46 +1,46 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -197,7 +197,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -213,17 +213,17 @@ procedure main() } goto l00000311; l00000311: - assume {:captureState "addr:0x728"}true; + assume {:captureState "addr:l00000311"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%00000327"} true; goto l00000302; l00000302: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l00000302"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/ifglobal/gcc_O2/ifglobal.expected b/src/test/correct/ifglobal/gcc_O2/ifglobal.expected index 80272f3dc..7fc29b6d1 100644 --- a/src/test/correct/ifglobal/gcc_O2/ifglobal.expected +++ b/src/test/correct/ifglobal/gcc_O2/ifglobal.expected @@ -1,40 +1,40 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,9 +84,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -181,7 +181,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, bvadd64(R0, 20bv64))), (gamma_load32(Gamma_mem, bvadd64(R0, 20bv64)) || L(mem, bvadd64(R0, 20bv64))); @@ -191,15 +191,15 @@ procedure main() } goto l00000396; l00000396: - assume {:captureState "addr:0x60c"}true; + assume {:captureState "addr:l00000396"} true; R1, Gamma_R1 := 1bv64, true; call rely(); assert (L(mem, bvadd64(R0, 20bv64)) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R0, 20bv64), R1[32:0]), gamma_store32(Gamma_mem, bvadd64(R0, 20bv64), Gamma_R1); - assume {:captureState "addr:0x610"}true; + assume {:captureState "%000003a1"} true; goto l000001b7; l000001b7: - assume {:captureState "addr:0x614"}true; + assume {:captureState "addr:l000001b7"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/ifglobal/gcc_no_plt_no_pic/ifglobal.expected b/src/test/correct/ifglobal/gcc_no_plt_no_pic/ifglobal.expected index 2f04514e3..a594b4954 100644 --- a/src/test/correct/ifglobal/gcc_no_plt_no_pic/ifglobal.expected +++ b/src/test/correct/ifglobal/gcc_no_plt_no_pic/ifglobal.expected @@ -1,46 +1,46 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -197,7 +197,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -213,17 +213,17 @@ procedure main() } goto l000008e5; l000008e5: - assume {:captureState "addr:0x728"}true; + assume {:captureState "addr:l000008e5"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%000008fb"} true; goto l000008d6; l000008d6: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l000008d6"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/ifglobal/gcc_pic/ifglobal.expected b/src/test/correct/ifglobal/gcc_pic/ifglobal.expected index 7b18bc7da..e39101a09 100644 --- a/src/test/correct/ifglobal/gcc_pic/ifglobal.expected +++ b/src/test/correct/ifglobal/gcc_pic/ifglobal.expected @@ -1,54 +1,54 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,9 +106,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -229,7 +229,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -246,7 +246,7 @@ procedure main() } goto l00000312; l00000312: - assume {:captureState "addr:0x768"}true; + assume {:captureState "addr:l00000312"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -254,10 +254,10 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x774"}true; + assume {:captureState "%00000329"} true; goto l00000303; l00000303: - assume {:captureState "addr:0x778"}true; + assume {:captureState "addr:l00000303"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/indirect_call/clang_O2/indirect_call.expected b/src/test/correct/indirect_call/clang_O2/indirect_call.expected index 365ea1180..101f70559 100644 --- a/src/test/correct/indirect_call/clang_O2/indirect_call.expected +++ b/src/test/correct/indirect_call/clang_O2/indirect_call.expected @@ -1,43 +1,43 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1952bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1952bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -120,7 +120,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -129,9 +129,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -316,12 +316,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x760"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000002fc"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%00000302"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 0bv64, true; @@ -330,14 +330,14 @@ procedure main() call puts(); goto l00000320; l00000320: - assume {:captureState "addr:0x774"}true; + assume {:captureState "addr:l00000320"} true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 1956bv64), Gamma_R0; R30, Gamma_R30 := 1920bv64, true; call puts(); goto l00000332; l00000332: - assume {:captureState "addr:0x780"}true; + assume {:captureState "addr:l00000332"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/indirect_call/gcc_O2/indirect_call.expected b/src/test/correct/indirect_call/gcc_O2/indirect_call.expected index 533297bf6..4439316c5 100644 --- a/src/test/correct/indirect_call/gcc_O2/indirect_call.expected +++ b/src/test/correct/indirect_call/gcc_O2/indirect_call.expected @@ -1,43 +1,43 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1984bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1984bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -126,7 +126,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -135,9 +135,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure greet() @@ -312,7 +312,7 @@ procedure greet() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lgreet: - assume {:captureState "addr:0x7a0"}true; + assume {:captureState "addr:lgreet"} true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 1992bv64), Gamma_R0; call puts(); @@ -514,12 +514,12 @@ procedure main() var #1: bv64; var Gamma_#1: bool; lmain: - assume {:captureState "addr:0x640"}true; + assume {:captureState "addr:lmain"} true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); - assume {:captureState "addr:0x640"}true; + assume {:captureState "%000001ca"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#1, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#1, 8bv64), Gamma_R30); - assume {:captureState "addr:0x640"}true; + assume {:captureState "%000001d0"} true; R31, Gamma_R31 := #1, Gamma_#1; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2008bv64), Gamma_R0; @@ -528,12 +528,12 @@ procedure main() call puts(); goto l000001ef; l000001ef: - assume {:captureState "addr:0x654"}true; + assume {:captureState "addr:l000001ef"} true; R30, Gamma_R30 := 1624bv64, true; call greet(); goto l00000205; l00000205: - assume {:captureState "addr:0x658"}true; + assume {:captureState "addr:l00000205"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/initialisation/clang/initialisation.expected b/src/test/correct/initialisation/clang/initialisation.expected index 78613bbad..4865cfdd4 100644 --- a/src/test/correct/initialisation/clang/initialisation.expected +++ b/src/test/correct/initialisation/clang/initialisation.expected @@ -1,86 +1,86 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R11: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R11: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$a_addr: bv64; -axiom {:extern }($a_addr == 69696bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69680bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69684bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R11: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R11: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $a_addr: bv64; +axiom ($a_addr == 69696bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69680bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd65(bv65, bv65) returns (bv65); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp64(bv64, bv64) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp65(bv65, bv65) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd65(bv65, bv65) returns (bv65); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp64(bv64, bv64) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp65(bv65, bv65) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_64(bv64) returns (bv65); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_64(bv64) returns (bv65); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_64(bv64) returns (bv65); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_64(bv64) returns (bv65); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -121,7 +121,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -130,9 +130,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -264,7 +264,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; R9, Gamma_R9 := bvadd64(R9, 64bv64), Gamma_R9; @@ -275,7 +275,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R11, 48bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R11, 48bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R11, 48bv64), Gamma_R10); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%00000322"} true; R11, Gamma_R11 := 69632bv64, true; call rely(); R10, Gamma_R10 := memory_load64_le(mem, bvadd64(R11, 56bv64)), (gamma_load64(Gamma_mem, bvadd64(R11, 56bv64)) || L(mem, bvadd64(R11, 56bv64))); @@ -288,14 +288,14 @@ procedure main() call rely(); assert (L(mem, bvadd64(R11, 56bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R11, 56bv64), R10), gamma_store64(Gamma_mem, bvadd64(R11, 56bv64), Gamma_R10); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%00000352"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 64bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 64bv64)) || L(mem, bvadd64(R8, 64bv64))); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 3bv32)), Gamma_R8; call rely(); assert (L(mem, bvadd64(R9, 4bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 4bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 4bv64), Gamma_R8); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000367"} true; R9, Gamma_R9 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend56_8(memory_load8_le(mem, bvadd64(R9, 52bv64))), (gamma_load8(Gamma_mem, bvadd64(R9, 52bv64)) || L(mem, bvadd64(R9, 52bv64))); @@ -303,7 +303,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R9, 52bv64), R8[8:0]), gamma_store8(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000381"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/initialisation/clang_O2/initialisation.expected b/src/test/correct/initialisation/clang_O2/initialisation.expected index d9f717d10..d85e30aaf 100644 --- a/src/test/correct/initialisation/clang_O2/initialisation.expected +++ b/src/test/correct/initialisation/clang_O2/initialisation.expected @@ -1,88 +1,88 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R11: bool; -var {:extern }Gamma_R12: bool; -var {:extern }Gamma_R13: bool; -var {:extern }Gamma_R14: bool; -var {:extern }Gamma_R15: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R11: bv64; -var {:extern }R12: bv64; -var {:extern }R13: bv64; -var {:extern }R14: bv64; -var {:extern }R15: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$a_addr: bv64; -axiom {:extern }($a_addr == 69696bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69680bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69684bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R11: bool; +var {:extern } Gamma_R12: bool; +var {:extern } Gamma_R13: bool; +var {:extern } Gamma_R14: bool; +var {:extern } Gamma_R15: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R11: bv64; +var {:extern } R12: bv64; +var {:extern } R13: bv64; +var {:extern } R14: bv64; +var {:extern } R15: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $a_addr: bv64; +axiom ($a_addr == 69696bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69680bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -123,7 +123,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -132,9 +132,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -256,7 +256,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R10, Gamma_R10 := 69632bv64, true; R10, Gamma_R10 := bvadd64(R10, 64bv64), Gamma_R10; R8, Gamma_R8 := 69632bv64, true; @@ -277,19 +277,19 @@ procedure main() call rely(); assert (L(mem, bvadd64(R10, 4bv64)) ==> Gamma_R11); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R10, 4bv64), R11[32:0]), gamma_store32(Gamma_mem, bvadd64(R10, 4bv64), Gamma_R11); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000349"} true; R10, Gamma_R10 := zero_extend32_32(bvadd32(R15[32:0], 1bv32)), Gamma_R15; call rely(); assert (L(mem, bvadd64(R8, 48bv64)) ==> Gamma_R13); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 48bv64), R13[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 48bv64), Gamma_R13); - assume {:captureState "addr:0x750"}true; + assume {:captureState "%00000357"} true; call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R14); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R9, 56bv64), R14), gamma_store64(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R14); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%0000035f"} true; call rely(); assert (L(mem, bvadd64(R12, 52bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R12, 52bv64), R10[8:0]), gamma_store8(Gamma_mem, bvadd64(R12, 52bv64), Gamma_R10); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000367"} true; return; } diff --git a/src/test/correct/initialisation/clang_no_plt_no_pic/initialisation.expected b/src/test/correct/initialisation/clang_no_plt_no_pic/initialisation.expected index 78613bbad..cb1eb0d81 100644 --- a/src/test/correct/initialisation/clang_no_plt_no_pic/initialisation.expected +++ b/src/test/correct/initialisation/clang_no_plt_no_pic/initialisation.expected @@ -1,86 +1,86 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R11: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R11: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$a_addr: bv64; -axiom {:extern }($a_addr == 69696bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69680bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69684bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R11: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R11: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $a_addr: bv64; +axiom ($a_addr == 69696bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69680bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd65(bv65, bv65) returns (bv65); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp64(bv64, bv64) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp65(bv65, bv65) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd65(bv65, bv65) returns (bv65); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp64(bv64, bv64) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp65(bv65, bv65) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_64(bv64) returns (bv65); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_64(bv64) returns (bv65); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_64(bv64) returns (bv65); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_64(bv64) returns (bv65); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -121,7 +121,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -130,9 +130,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -264,7 +264,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; R9, Gamma_R9 := bvadd64(R9, 64bv64), Gamma_R9; @@ -275,7 +275,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R11, 48bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R11, 48bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R11, 48bv64), Gamma_R10); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%0000096a"} true; R11, Gamma_R11 := 69632bv64, true; call rely(); R10, Gamma_R10 := memory_load64_le(mem, bvadd64(R11, 56bv64)), (gamma_load64(Gamma_mem, bvadd64(R11, 56bv64)) || L(mem, bvadd64(R11, 56bv64))); @@ -288,14 +288,14 @@ procedure main() call rely(); assert (L(mem, bvadd64(R11, 56bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R11, 56bv64), R10), gamma_store64(Gamma_mem, bvadd64(R11, 56bv64), Gamma_R10); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%0000099a"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 64bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 64bv64)) || L(mem, bvadd64(R8, 64bv64))); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 3bv32)), Gamma_R8; call rely(); assert (L(mem, bvadd64(R9, 4bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 4bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 4bv64), Gamma_R8); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%000009af"} true; R9, Gamma_R9 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend56_8(memory_load8_le(mem, bvadd64(R9, 52bv64))), (gamma_load8(Gamma_mem, bvadd64(R9, 52bv64)) || L(mem, bvadd64(R9, 52bv64))); @@ -303,7 +303,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R9, 52bv64), R8[8:0]), gamma_store8(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%000009c9"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/initialisation/clang_pic/initialisation.expected b/src/test/correct/initialisation/clang_pic/initialisation.expected index a23c84893..eaefa7a71 100644 --- a/src/test/correct/initialisation/clang_pic/initialisation.expected +++ b/src/test/correct/initialisation/clang_pic/initialisation.expected @@ -1,84 +1,84 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$a_addr: bv64; -axiom {:extern }($a_addr == 69696bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69680bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69684bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $a_addr: bv64; +axiom ($a_addr == 69696bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69680bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd65(bv65, bv65) returns (bv65); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp64(bv64, bv64) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp65(bv65, bv65) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd65(bv65, bv65) returns (bv65); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp64(bv64, bv64) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp65(bv65, bv65) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_64(bv64) returns (bv65); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_64(bv64) returns (bv65); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_64(bv64) returns (bv65); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_64(bv64) returns (bv65); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -151,7 +151,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69566bv64) == 0bv8); free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -160,9 +160,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -358,7 +358,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x794"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); @@ -371,7 +371,7 @@ procedure main() call rely(); assert (L(mem, R10) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R10, R8[32:0]), gamma_store32(Gamma_mem, R10, Gamma_R8); - assume {:captureState "addr:0x7ac"}true; + assume {:captureState "%0000032d"} true; R10, Gamma_R10 := 65536bv64, true; call rely(); R10, Gamma_R10 := memory_load64_le(mem, bvadd64(R10, 4016bv64)), (gamma_load64(Gamma_mem, bvadd64(R10, 4016bv64)) || L(mem, bvadd64(R10, 4016bv64))); @@ -386,14 +386,14 @@ procedure main() call rely(); assert (L(mem, R10) ==> Gamma_R8); mem, Gamma_mem := memory_store64_le(mem, R10, R8), gamma_store64(Gamma_mem, R10, Gamma_R8); - assume {:captureState "addr:0x7c0"}true; + assume {:captureState "%00000364"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R9)), (gamma_load32(Gamma_mem, R9) || L(mem, R9)); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 3bv32)), Gamma_R8; call rely(); assert (L(mem, bvadd64(R9, 4bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 4bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 4bv64), Gamma_R8); - assume {:captureState "addr:0x7cc"}true; + assume {:captureState "%00000379"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4048bv64)) || L(mem, bvadd64(R9, 4048bv64))); @@ -403,7 +403,7 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x7e0"}true; + assume {:captureState "%0000039a"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/initialisation/gcc/initialisation.expected b/src/test/correct/initialisation/gcc/initialisation.expected index cea56edea..e0bc5e761 100644 --- a/src/test/correct/initialisation/gcc/initialisation.expected +++ b/src/test/correct/initialisation/gcc/initialisation.expected @@ -1,74 +1,74 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$a_addr: bv64; -axiom {:extern }($a_addr == 69664bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69648bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $a_addr: bv64; +axiom ($a_addr == 69664bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69648bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,7 +109,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -118,9 +118,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -242,7 +242,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -253,7 +253,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%0000034f"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -264,7 +264,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store64_le(mem, R0, R1), gamma_store64(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%0000037a"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 32bv64), Gamma_R0; call rely(); @@ -275,7 +275,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R0, 4bv64)) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R0, 4bv64), R1[32:0]), gamma_store32(Gamma_mem, bvadd64(R0, 4bv64), Gamma_R1); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%000003a5"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -287,7 +287,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%000003d6"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/initialisation/gcc_O2/initialisation.expected b/src/test/correct/initialisation/gcc_O2/initialisation.expected index 61ab8d5a3..c9efe3b33 100644 --- a/src/test/correct/initialisation/gcc_O2/initialisation.expected +++ b/src/test/correct/initialisation/gcc_O2/initialisation.expected @@ -1,84 +1,84 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R3: bool; -var {:extern }Gamma_R4: bool; -var {:extern }Gamma_R5: bool; -var {:extern }Gamma_R6: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }R3: bv64; -var {:extern }R4: bv64; -var {:extern }R5: bv64; -var {:extern }R6: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$a_addr: bv64; -axiom {:extern }($a_addr == 69664bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69648bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69672bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R3: bool; +var {:extern } Gamma_R4: bool; +var {:extern } Gamma_R5: bool; +var {:extern } Gamma_R6: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R3: bv64; +var {:extern } R4: bv64; +var {:extern } R5: bv64; +var {:extern } R6: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $a_addr: bv64; +axiom ($a_addr == 69664bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69648bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69672bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -119,7 +119,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -128,9 +128,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -253,7 +253,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R5, Gamma_R5 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R5, 16bv64), Gamma_R5; R0, Gamma_R0 := 0bv64, true; @@ -271,19 +271,19 @@ procedure main() call rely(); assert (L(mem, bvadd64(R5, 16bv64)) ==> Gamma_R6); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R5, 16bv64), R6[32:0]), gamma_store32(Gamma_mem, bvadd64(R5, 16bv64), Gamma_R6); - assume {:captureState "addr:0x628"}true; + assume {:captureState "%000001ec"} true; R3, Gamma_R3 := zero_extend32_32(bvadd32(R3[32:0], 3bv32)), Gamma_R3; call rely(); assert (L(mem, bvadd64(R1, 8bv64)) ==> Gamma_R4); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R1, 8bv64), R4), gamma_store64(Gamma_mem, bvadd64(R1, 8bv64), Gamma_R4); - assume {:captureState "addr:0x630"}true; + assume {:captureState "%000001fa"} true; call rely(); assert (L(mem, bvadd64(R1, 20bv64)) ==> Gamma_R3); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R3[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R3); - assume {:captureState "addr:0x634"}true; + assume {:captureState "%00000202"} true; call rely(); assert (L(mem, bvadd64(R1, 24bv64)) ==> Gamma_R2); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R1, 24bv64), R2[8:0]), gamma_store8(Gamma_mem, bvadd64(R1, 24bv64), Gamma_R2); - assume {:captureState "addr:0x638"}true; + assume {:captureState "%0000020a"} true; return; } diff --git a/src/test/correct/initialisation/gcc_no_plt_no_pic/initialisation.expected b/src/test/correct/initialisation/gcc_no_plt_no_pic/initialisation.expected index cea56edea..d3f07b396 100644 --- a/src/test/correct/initialisation/gcc_no_plt_no_pic/initialisation.expected +++ b/src/test/correct/initialisation/gcc_no_plt_no_pic/initialisation.expected @@ -1,74 +1,74 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$a_addr: bv64; -axiom {:extern }($a_addr == 69664bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69648bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $a_addr: bv64; +axiom ($a_addr == 69664bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69648bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,7 +109,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -118,9 +118,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -242,7 +242,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -253,7 +253,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%00000a02"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -264,7 +264,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store64_le(mem, R0, R1), gamma_store64(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000a2d"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 32bv64), Gamma_R0; call rely(); @@ -275,7 +275,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R0, 4bv64)) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R0, 4bv64), R1[32:0]), gamma_store32(Gamma_mem, bvadd64(R0, 4bv64), Gamma_R1); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%00000a58"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -287,7 +287,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%00000a89"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/initialisation/gcc_pic/initialisation.expected b/src/test/correct/initialisation/gcc_pic/initialisation.expected index 57dd25c5e..c0c85331e 100644 --- a/src/test/correct/initialisation/gcc_pic/initialisation.expected +++ b/src/test/correct/initialisation/gcc_pic/initialisation.expected @@ -1,74 +1,74 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$a_addr: bv64; -axiom {:extern }($a_addr == 69664bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69648bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $a_addr: bv64; +axiom ($a_addr == 69664bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69648bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -141,7 +141,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -150,9 +150,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -338,7 +338,7 @@ procedure main() free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x794"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4048bv64)) || L(mem, bvadd64(R0, 4048bv64))); @@ -351,7 +351,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x7ac"}true; + assume {:captureState "%00000351"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4040bv64)) || L(mem, bvadd64(R0, 4040bv64))); @@ -364,7 +364,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store64_le(mem, R0, R1), gamma_store64(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x7c8"}true; + assume {:captureState "%0000037e"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -377,7 +377,7 @@ procedure main() call rely(); assert (L(mem, bvadd64(R0, 4bv64)) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R0, 4bv64), R1[32:0]), gamma_store32(Gamma_mem, bvadd64(R0, 4bv64), Gamma_R1); - assume {:captureState "addr:0x7e4"}true; + assume {:captureState "%000003ab"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -391,7 +391,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x804"}true; + assume {:captureState "%000003de"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/jumptable/clang_O2/jumptable.expected b/src/test/correct/jumptable/clang_O2/jumptable.expected index 4cf96683d..467d96736 100644 --- a/src/test/correct/jumptable/clang_O2/jumptable.expected +++ b/src/test/correct/jumptable/clang_O2/jumptable.expected @@ -1,43 +1,43 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1916bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69680bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1916bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69680bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -78,7 +78,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,9 +87,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -188,7 +188,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x750"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); @@ -197,6 +197,6 @@ procedure main() call rely(); assert (L(mem, bvadd64(R8, 48bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 48bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 48bv64), Gamma_R9); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%00000378"} true; return; } diff --git a/src/test/correct/jumptable/gcc_O2/jumptable.expected b/src/test/correct/jumptable/gcc_O2/jumptable.expected index 3906a8378..47773b7fd 100644 --- a/src/test/correct/jumptable/gcc_O2/jumptable.expected +++ b/src/test/correct/jumptable/gcc_O2/jumptable.expected @@ -1,65 +1,65 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1976bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69648bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1976bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69648bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,7 +100,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,9 +109,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure add_six() @@ -190,7 +190,7 @@ procedure add_six() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { ladd_six: - assume {:captureState "addr:0x774"}true; + assume {:captureState "addr:ladd_six"} true; R1, Gamma_R1 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); @@ -198,7 +198,7 @@ procedure add_six() call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); - assume {:captureState "addr:0x780"}true; + assume {:captureState "%00000252"} true; return; } @@ -278,7 +278,7 @@ procedure add_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { ladd_two: - assume {:captureState "addr:0x760"}true; + assume {:captureState "addr:ladd_two"} true; R1, Gamma_R1 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); @@ -286,7 +286,7 @@ procedure add_two() call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); - assume {:captureState "addr:0x76c"}true; + assume {:captureState "%00000233"} true; return; } @@ -392,29 +392,29 @@ procedure main() var #1: bv64; var Gamma_#1: bool; lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); - assume {:captureState "addr:0x600"}true; + assume {:captureState "%00000202"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#1, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#1, 8bv64), Gamma_R30); - assume {:captureState "addr:0x600"}true; + assume {:captureState "%00000208"} true; R31, Gamma_R31 := #1, Gamma_#1; R29, Gamma_R29 := R31, Gamma_R31; R30, Gamma_R30 := 1548bv64, true; call add_two(); goto l0000027c; l0000027c: - assume {:captureState "addr:0x60c"}true; + assume {:captureState "addr:l0000027c"} true; R30, Gamma_R30 := 1552bv64, true; call add_six(); goto l00000283; l00000283: - assume {:captureState "addr:0x610"}true; + assume {:captureState "addr:l00000283"} true; R30, Gamma_R30 := 1556bv64, true; call sub_seven(); goto l0000028a; l0000028a: - assume {:captureState "addr:0x614"}true; + assume {:captureState "addr:l0000028a"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -498,7 +498,7 @@ procedure sub_seven() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lsub_seven: - assume {:captureState "addr:0x790"}true; + assume {:captureState "addr:lsub_seven"} true; R1, Gamma_R1 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); @@ -506,6 +506,6 @@ procedure sub_seven() call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); - assume {:captureState "addr:0x79c"}true; + assume {:captureState "%00000275"} true; return; } diff --git a/src/test/correct/jumptable3/gcc/jumptable3.expected b/src/test/correct/jumptable3/gcc/jumptable3.expected index 6f0078804..bb2282634 100644 --- a/src/test/correct/jumptable3/gcc/jumptable3.expected +++ b/src/test/correct/jumptable3/gcc/jumptable3.expected @@ -1,69 +1,69 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"}bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -104,7 +104,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -113,9 +113,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure add_six() @@ -194,7 +194,7 @@ procedure add_six() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { ladd_six: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:ladd_six"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -205,7 +205,7 @@ procedure add_six() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x750"}true; + assume {:captureState "%00000511"} true; return; } @@ -285,7 +285,7 @@ procedure add_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { ladd_two: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:ladd_two"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -296,7 +296,7 @@ procedure add_two() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%000004df"} true; return; } @@ -455,18 +455,18 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x780"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x780"}true; + assume {:captureState "%00000556"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x780"}true; + assume {:captureState "%0000055c"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x788"}true; + assume {:captureState "%0000056e"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); - assume {:captureState "addr:0x78c"}true; + assume {:captureState "%00000576"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967284bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934581bv33))), (Gamma_R0 && Gamma_#5); @@ -479,7 +479,7 @@ procedure main() } goto l000005e0; l000005e0: - assume {:captureState "addr:0x79c"}true; + assume {:captureState "addr:l000005e0"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967284bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934581bv33))), (Gamma_R0 && Gamma_#6); @@ -492,7 +492,7 @@ procedure main() } goto l00000608; l00000608: - assume {:captureState "addr:0x7a8"}true; + assume {:captureState "addr:l00000608"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #7, Gamma_#7 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#7); @@ -505,35 +505,35 @@ procedure main() } goto l00000643; l00000629: - assume {:captureState "addr:0x8ec"}true; + assume {:captureState "addr:l00000629"} true; R30, Gamma_R30 := 2288bv64, true; call sub_seven(); goto l00000635; l00000635: - assume {:captureState "addr:0x8f0"}true; + assume {:captureState "addr:l00000635"} true; R30, Gamma_R30 := 2292bv64, true; call add_two(); goto l0000063c; l0000063c: - assume {:captureState "addr:0x8f4"}true; + assume {:captureState "addr:l0000063c"} true; R30, Gamma_R30 := 2296bv64, true; call add_six(); goto l00000599; l00000599: - assume {:captureState "addr:0x8f8"}true; + assume {:captureState "addr:l00000599"} true; R30, Gamma_R30 := 2300bv64, true; call sub_seven(); goto l000005a5; l000005a5: - assume {:captureState "addr:0x8fc"}true; + assume {:captureState "addr:l000005a5"} true; R30, Gamma_R30 := 2304bv64, true; call add_two(); goto l000005ac; l000005ac: - assume {:captureState "addr:0x900"}true; + assume {:captureState "addr:l000005ac"} true; goto l000005ad; l00000643: - assume {:captureState "addr:0x7b4"}true; + assume {:captureState "addr:l00000643"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #8, Gamma_#8 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#8); @@ -546,7 +546,7 @@ procedure main() } goto l0000066b; l0000066b: - assume {:captureState "addr:0x7c0"}true; + assume {:captureState "addr:l0000066b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #9, Gamma_#9 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#9); @@ -559,20 +559,20 @@ procedure main() } goto l000006a3; l0000068c: - assume {:captureState "addr:0x8e0"}true; + assume {:captureState "addr:l0000068c"} true; R30, Gamma_R30 := 2276bv64, true; call add_two(); goto l00000698; l00000698: - assume {:captureState "addr:0x8e4"}true; + assume {:captureState "addr:l00000698"} true; R30, Gamma_R30 := 2280bv64, true; call add_six(); goto l0000069f; l0000069f: - assume {:captureState "addr:0x8e8"}true; + assume {:captureState "addr:l0000069f"} true; goto l000005ad; l000006a3: - assume {:captureState "addr:0x7cc"}true; + assume {:captureState "addr:l000006a3"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #10, Gamma_#10 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#10); @@ -585,7 +585,7 @@ procedure main() } goto l000006cb; l000006cb: - assume {:captureState "addr:0x7d8"}true; + assume {:captureState "addr:l000006cb"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #11, Gamma_#11 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#11); @@ -598,7 +598,7 @@ procedure main() } goto l00000703; l00000703: - assume {:captureState "addr:0x7e4"}true; + assume {:captureState "addr:l00000703"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #12, Gamma_#12 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#12); @@ -611,7 +611,7 @@ procedure main() } goto l0000072b; l0000072b: - assume {:captureState "addr:0x7f0"}true; + assume {:captureState "addr:l0000072b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #13, Gamma_#13 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#13, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#13); @@ -624,7 +624,7 @@ procedure main() } goto l00000758; l00000758: - assume {:captureState "addr:0x7fc"}true; + assume {:captureState "addr:l00000758"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #14, Gamma_#14 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#14, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#14); @@ -637,7 +637,7 @@ procedure main() } goto l00000780; l00000780: - assume {:captureState "addr:0x808"}true; + assume {:captureState "addr:l00000780"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #15, Gamma_#15 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#15, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#15); @@ -650,7 +650,7 @@ procedure main() } goto l000007ad; l000007ad: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:l000007ad"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #16, Gamma_#16 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#16, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#16); @@ -663,7 +663,7 @@ procedure main() } goto l000007d5; l000007d5: - assume {:captureState "addr:0x820"}true; + assume {:captureState "addr:l000007d5"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #17, Gamma_#17 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#17, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#17); @@ -676,40 +676,40 @@ procedure main() } goto l00000809; l000007f6: - assume {:captureState "addr:0x8c4"}true; + assume {:captureState "addr:l000007f6"} true; R30, Gamma_R30 := 2248bv64, true; call add_six(); goto l00000802; l00000802: - assume {:captureState "addr:0x8c8"}true; + assume {:captureState "addr:l00000802"} true; R30, Gamma_R30 := 2252bv64, true; call add_two(); goto l000007a1; l000007a1: - assume {:captureState "addr:0x8cc"}true; + assume {:captureState "addr:l000007a1"} true; R30, Gamma_R30 := 2256bv64, true; call add_six(); goto l0000074c; l0000074c: - assume {:captureState "addr:0x8d0"}true; + assume {:captureState "addr:l0000074c"} true; R30, Gamma_R30 := 2260bv64, true; call sub_seven(); goto l000006ec; l000006ec: - assume {:captureState "addr:0x8d4"}true; + assume {:captureState "addr:l000006ec"} true; R30, Gamma_R30 := 2264bv64, true; call sub_seven(); goto l000006f8; l000006f8: - assume {:captureState "addr:0x8d8"}true; + assume {:captureState "addr:l000006f8"} true; R30, Gamma_R30 := 2268bv64, true; call add_six(); goto l000006ff; l000006ff: - assume {:captureState "addr:0x8dc"}true; + assume {:captureState "addr:l000006ff"} true; goto l000005ad; l00000809: - assume {:captureState "addr:0x82c"}true; + assume {:captureState "addr:l00000809"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #18, Gamma_#18 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#18, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#18); @@ -722,7 +722,7 @@ procedure main() } goto l00000831; l00000831: - assume {:captureState "addr:0x838"}true; + assume {:captureState "addr:l00000831"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #19, Gamma_#19 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#19, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#19); @@ -735,15 +735,15 @@ procedure main() } goto l00000862; l00000852: - assume {:captureState "addr:0x8bc"}true; + assume {:captureState "addr:l00000852"} true; R30, Gamma_R30 := 2240bv64, true; call add_six(); goto l0000085e; l0000085e: - assume {:captureState "addr:0x8c0"}true; + assume {:captureState "addr:l0000085e"} true; goto l000005ad; l00000862: - assume {:captureState "addr:0x844"}true; + assume {:captureState "addr:l00000862"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #20, Gamma_#20 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#20, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#20); @@ -756,7 +756,7 @@ procedure main() } goto l0000088a; l0000088a: - assume {:captureState "addr:0x850"}true; + assume {:captureState "addr:l0000088a"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #21, Gamma_#21 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#21, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#21); @@ -769,20 +769,20 @@ procedure main() } goto l000008c2; l000008ab: - assume {:captureState "addr:0x8b0"}true; + assume {:captureState "addr:l000008ab"} true; R30, Gamma_R30 := 2228bv64, true; call add_two(); goto l000008b7; l000008b7: - assume {:captureState "addr:0x8b4"}true; + assume {:captureState "addr:l000008b7"} true; R30, Gamma_R30 := 2232bv64, true; call sub_seven(); goto l000008be; l000008be: - assume {:captureState "addr:0x8b8"}true; + assume {:captureState "addr:l000008be"} true; goto l000005ad; l000008c2: - assume {:captureState "addr:0x85c"}true; + assume {:captureState "addr:l000008c2"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #22, Gamma_#22 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#22, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#22); @@ -795,7 +795,7 @@ procedure main() } goto l000008ea; l000008ea: - assume {:captureState "addr:0x868"}true; + assume {:captureState "addr:l000008ea"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #23, Gamma_#23 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#23, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#23); @@ -808,7 +808,7 @@ procedure main() } goto l0000091b; l0000091b: - assume {:captureState "addr:0x874"}true; + assume {:captureState "addr:l0000091b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #24, Gamma_#24 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#24, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#24); @@ -821,7 +821,7 @@ procedure main() } goto l00000943; l00000943: - assume {:captureState "addr:0x880"}true; + assume {:captureState "addr:l00000943"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #25, Gamma_#25 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#25, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#25); @@ -834,15 +834,15 @@ procedure main() } goto l0000097b; l00000964: - assume {:captureState "addr:0x89c"}true; + assume {:captureState "addr:l00000964"} true; R30, Gamma_R30 := 2208bv64, true; call add_two(); goto l00000970; l00000970: - assume {:captureState "addr:0x8a0"}true; + assume {:captureState "addr:l00000970"} true; goto l000005ad; l0000097b: - assume {:captureState "addr:0x88c"}true; + assume {:captureState "addr:l0000097b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #26, Gamma_#26 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#26, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#26); @@ -855,34 +855,34 @@ procedure main() } goto l000009a1; l00000974: - assume {:captureState "addr:0x8a4"}true; + assume {:captureState "addr:l00000974"} true; R30, Gamma_R30 := 2216bv64, true; call add_six(); goto l0000090b; l0000090b: - assume {:captureState "addr:0x8a8"}true; + assume {:captureState "addr:l0000090b"} true; R30, Gamma_R30 := 2220bv64, true; call sub_seven(); goto l00000917; l00000917: - assume {:captureState "addr:0x8ac"}true; + assume {:captureState "addr:l00000917"} true; goto l000005ad; l000005ad: - assume {:captureState "addr:0x90c"}true; + assume {:captureState "addr:l000005ad"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); goto l000005c2; l000009a1: - assume {:captureState "addr:0x898"}true; + assume {:captureState "addr:l000009a1"} true; goto l000005d7; l000005d7: - assume {:captureState "addr:0x904"}true; + assume {:captureState "addr:l000005d7"} true; R0, Gamma_R0 := 1bv64, true; goto l000005c2; l000005c2: - assume {:captureState "addr:0x918"}true; + assume {:captureState "addr:l000005c2"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; @@ -965,7 +965,7 @@ procedure sub_seven() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lsub_seven: - assume {:captureState "addr:0x75c"}true; + assume {:captureState "addr:lsub_seven"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -976,6 +976,6 @@ procedure sub_seven() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x774"}true; + assume {:captureState "%00000543"} true; return; } diff --git a/src/test/correct/jumptable3/gcc_O2/jumptable3.expected b/src/test/correct/jumptable3/gcc_O2/jumptable3.expected index f1b44ef8f..12f14eba8 100644 --- a/src/test/correct/jumptable3/gcc_O2/jumptable3.expected +++ b/src/test/correct/jumptable3/gcc_O2/jumptable3.expected @@ -1,45 +1,45 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"}bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -80,7 +80,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,9 +89,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -219,7 +219,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; #1, Gamma_#1 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#1, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#1); @@ -232,14 +232,14 @@ procedure main() } goto l00000753; l00000753: - assume {:captureState "addr:0x60c"}true; + assume {:captureState "addr:l00000753"} true; assert (Gamma_ZF && (Gamma_VF && Gamma_NF)); if ((bvand1(bvcomp1(NF, VF), bvcomp1(ZF, 0bv1)) != 0bv1)) { goto l000006e8; } goto l0000075c; l000006e8: - assume {:captureState "addr:0x688"}true; + assume {:captureState "addr:l000006e8"} true; R1, Gamma_R1 := 69632bv64, true; #8, Gamma_#8 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#8); @@ -252,24 +252,24 @@ procedure main() } goto l0000070c; l000005f9: - assume {:captureState "addr:0x710"}true; + assume {:captureState "addr:l000005f9"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 8bv32)), Gamma_R0; call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%0000060c"} true; goto l00000360; l0000070c: - assume {:captureState "addr:0x694"}true; + assume {:captureState "addr:l0000070c"} true; assert (Gamma_ZF && (Gamma_VF && Gamma_NF)); if ((bvnot1(bvand1(bvcomp1(NF, VF), bvcomp1(ZF, 0bv1))) != 0bv1)) { goto l00000644; } goto l00000715; l00000644: - assume {:captureState "addr:0x6b8"}true; + assume {:captureState "addr:l00000644"} true; #6, Gamma_#6 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#6); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#6, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967289bv33))), (Gamma_R0 && Gamma_#6); @@ -281,7 +281,7 @@ procedure main() } goto l00000663; l00000663: - assume {:captureState "addr:0x6c0"}true; + assume {:captureState "addr:l00000663"} true; #7, Gamma_#7 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#7); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#7, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967288bv33))), (Gamma_R0 && Gamma_#7); @@ -293,7 +293,7 @@ procedure main() } goto l00000347; l00000715: - assume {:captureState "addr:0x698"}true; + assume {:captureState "addr:l00000715"} true; #9, Gamma_#9 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#9); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#9, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967286bv33))), (Gamma_R0 && Gamma_#9); @@ -305,17 +305,17 @@ procedure main() } goto l00000734; l00000612: - assume {:captureState "addr:0x720"}true; + assume {:captureState "addr:l00000612"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 1bv32)), Gamma_R0; call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000625"} true; goto l00000628; l00000734: - assume {:captureState "addr:0x6a0"}true; + assume {:captureState "addr:l00000734"} true; #10, Gamma_#10 := bvadd32(R0[32:0], 4294967284bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934581bv33))), (Gamma_R0 && Gamma_#10); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#10, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967285bv33))), (Gamma_R0 && Gamma_#10); @@ -327,17 +327,17 @@ procedure main() } goto l00000628; l00000628: - assume {:captureState "addr:0x6a8"}true; + assume {:captureState "addr:l00000628"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 4294967291bv32)), Gamma_R0; call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); - assume {:captureState "addr:0x6b0"}true; + assume {:captureState "%0000063e"} true; goto l00000360; l0000075c: - assume {:captureState "addr:0x610"}true; + assume {:captureState "addr:l0000075c"} true; #11, Gamma_#11 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#11); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#11, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967293bv33))), (Gamma_R0 && Gamma_#11); @@ -349,7 +349,7 @@ procedure main() } goto l0000077b; l0000069c: - assume {:captureState "addr:0x6d8"}true; + assume {:captureState "addr:l0000069c"} true; R1, Gamma_R1 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); @@ -357,17 +357,17 @@ procedure main() call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); - assume {:captureState "addr:0x6e4"}true; + assume {:captureState "%000006b4"} true; goto l00000360; l0000077b: - assume {:captureState "addr:0x618"}true; + assume {:captureState "addr:l0000077b"} true; assert (Gamma_ZF && (Gamma_VF && Gamma_NF)); if ((bvand1(bvcomp1(NF, VF), bvcomp1(ZF, 0bv1)) != 0bv1)) { goto l000005bc; } goto l00000784; l000005bc: - assume {:captureState "addr:0x654"}true; + assume {:captureState "addr:l000005bc"} true; #5, Gamma_#5 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#5); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#5, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967292bv33))), (Gamma_R0 && Gamma_#5); @@ -379,7 +379,7 @@ procedure main() } goto l00000682; l000005d6: - assume {:captureState "addr:0x6fc"}true; + assume {:captureState "addr:l000005d6"} true; R1, Gamma_R1 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); @@ -387,10 +387,10 @@ procedure main() call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); - assume {:captureState "addr:0x708"}true; + assume {:captureState "%000005f3"} true; goto l00000360; l00000682: - assume {:captureState "addr:0x65c"}true; + assume {:captureState "addr:l00000682"} true; R1, Gamma_R1 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); @@ -398,40 +398,40 @@ procedure main() call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); - assume {:captureState "addr:0x668"}true; + assume {:captureState "%0000069a"} true; goto l00000317; l00000317: - assume {:captureState "addr:0x66c"}true; + assume {:captureState "addr:l00000317"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 6bv32)), Gamma_R0; call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); - assume {:captureState "addr:0x674"}true; + assume {:captureState "%0000032f"} true; goto l00000331; l00000331: - assume {:captureState "addr:0x678"}true; + assume {:captureState "addr:l00000331"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 4294967289bv32)), Gamma_R0; call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); - assume {:captureState "addr:0x680"}true; + assume {:captureState "%00000344"} true; goto l00000347; l00000347: - assume {:captureState "addr:0x6c8"}true; + assume {:captureState "addr:l00000347"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 4294967295bv32)), Gamma_R0; call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); - assume {:captureState "addr:0x6d0"}true; + assume {:captureState "%0000035d"} true; goto l00000360; l00000784: - assume {:captureState "addr:0x61c"}true; + assume {:captureState "addr:l00000784"} true; R1, Gamma_R1 := 69632bv64, true; #12, Gamma_#12 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#12); @@ -444,17 +444,17 @@ procedure main() } goto l000007a8; l000006ba: - assume {:captureState "addr:0x6ec"}true; + assume {:captureState "addr:l000006ba"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 6bv32)), Gamma_R0; call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); - assume {:captureState "addr:0x6f4"}true; + assume {:captureState "%000006cd"} true; goto l000006d0; l000007a8: - assume {:captureState "addr:0x628"}true; + assume {:captureState "addr:l000007a8"} true; #13, Gamma_#13 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#13, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#13); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#13, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967294bv33))), (Gamma_R0 && Gamma_#13); @@ -466,37 +466,37 @@ procedure main() } goto l000006d0; l00000368: - assume {:captureState "addr:0x640"}true; + assume {:captureState "addr:l00000368"} true; assert Gamma_R0; if ((bvnot1(bvcomp32(R0[32:0], 0bv32)) != 0bv1)) { goto l0000036b; } goto l000005a3; l0000036b: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l0000036b"} true; R0, Gamma_R0 := 1bv64, true; return; l000005a3: - assume {:captureState "addr:0x644"}true; + assume {:captureState "addr:l000005a3"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 2bv32)), Gamma_R0; call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); - assume {:captureState "addr:0x64c"}true; + assume {:captureState "%000005b6"} true; goto l00000360; l000006d0: - assume {:captureState "addr:0x630"}true; + assume {:captureState "addr:l000006d0"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 4294967289bv32)), Gamma_R0; call rely(); assert (L(mem, bvadd64(R1, 16bv64)) ==> Gamma_R0); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 16bv64), R0[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 16bv64), Gamma_R0); - assume {:captureState "addr:0x638"}true; + assume {:captureState "%000006e6"} true; goto l00000360; l00000360: - assume {:captureState "addr:0x63c"}true; + assume {:captureState "addr:l00000360"} true; return; } diff --git a/src/test/correct/jumptable3/gcc_no_plt_no_pic/jumptable3.expected b/src/test/correct/jumptable3/gcc_no_plt_no_pic/jumptable3.expected index c8c1c38f9..910e07a93 100644 --- a/src/test/correct/jumptable3/gcc_no_plt_no_pic/jumptable3.expected +++ b/src/test/correct/jumptable3/gcc_no_plt_no_pic/jumptable3.expected @@ -1,69 +1,69 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"}bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -104,7 +104,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -113,9 +113,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure add_six() @@ -194,7 +194,7 @@ procedure add_six() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { ladd_six: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:ladd_six"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -205,7 +205,7 @@ procedure add_six() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x750"}true; + assume {:captureState "%0000126c"} true; return; } @@ -285,7 +285,7 @@ procedure add_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { ladd_two: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:ladd_two"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -296,7 +296,7 @@ procedure add_two() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%0000123a"} true; return; } @@ -455,18 +455,18 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x780"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x780"}true; + assume {:captureState "%000012b1"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x780"}true; + assume {:captureState "%000012b7"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x788"}true; + assume {:captureState "%000012c9"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); - assume {:captureState "addr:0x78c"}true; + assume {:captureState "%000012d1"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967284bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934581bv33))), (Gamma_R0 && Gamma_#5); @@ -479,7 +479,7 @@ procedure main() } goto l0000133b; l0000133b: - assume {:captureState "addr:0x79c"}true; + assume {:captureState "addr:l0000133b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967284bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934581bv33))), (Gamma_R0 && Gamma_#6); @@ -492,7 +492,7 @@ procedure main() } goto l00001363; l00001363: - assume {:captureState "addr:0x7a8"}true; + assume {:captureState "addr:l00001363"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #7, Gamma_#7 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#7); @@ -505,35 +505,35 @@ procedure main() } goto l0000139e; l00001384: - assume {:captureState "addr:0x8ec"}true; + assume {:captureState "addr:l00001384"} true; R30, Gamma_R30 := 2288bv64, true; call sub_seven(); goto l00001390; l00001390: - assume {:captureState "addr:0x8f0"}true; + assume {:captureState "addr:l00001390"} true; R30, Gamma_R30 := 2292bv64, true; call add_two(); goto l00001397; l00001397: - assume {:captureState "addr:0x8f4"}true; + assume {:captureState "addr:l00001397"} true; R30, Gamma_R30 := 2296bv64, true; call add_six(); goto l000012f4; l000012f4: - assume {:captureState "addr:0x8f8"}true; + assume {:captureState "addr:l000012f4"} true; R30, Gamma_R30 := 2300bv64, true; call sub_seven(); goto l00001300; l00001300: - assume {:captureState "addr:0x8fc"}true; + assume {:captureState "addr:l00001300"} true; R30, Gamma_R30 := 2304bv64, true; call add_two(); goto l00001307; l00001307: - assume {:captureState "addr:0x900"}true; + assume {:captureState "addr:l00001307"} true; goto l00001308; l0000139e: - assume {:captureState "addr:0x7b4"}true; + assume {:captureState "addr:l0000139e"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #8, Gamma_#8 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#8); @@ -546,7 +546,7 @@ procedure main() } goto l000013c6; l000013c6: - assume {:captureState "addr:0x7c0"}true; + assume {:captureState "addr:l000013c6"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #9, Gamma_#9 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#9); @@ -559,20 +559,20 @@ procedure main() } goto l000013fe; l000013e7: - assume {:captureState "addr:0x8e0"}true; + assume {:captureState "addr:l000013e7"} true; R30, Gamma_R30 := 2276bv64, true; call add_two(); goto l000013f3; l000013f3: - assume {:captureState "addr:0x8e4"}true; + assume {:captureState "addr:l000013f3"} true; R30, Gamma_R30 := 2280bv64, true; call add_six(); goto l000013fa; l000013fa: - assume {:captureState "addr:0x8e8"}true; + assume {:captureState "addr:l000013fa"} true; goto l00001308; l000013fe: - assume {:captureState "addr:0x7cc"}true; + assume {:captureState "addr:l000013fe"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #10, Gamma_#10 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#10); @@ -585,7 +585,7 @@ procedure main() } goto l00001426; l00001426: - assume {:captureState "addr:0x7d8"}true; + assume {:captureState "addr:l00001426"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #11, Gamma_#11 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#11); @@ -598,7 +598,7 @@ procedure main() } goto l0000145e; l0000145e: - assume {:captureState "addr:0x7e4"}true; + assume {:captureState "addr:l0000145e"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #12, Gamma_#12 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#12); @@ -611,7 +611,7 @@ procedure main() } goto l00001486; l00001486: - assume {:captureState "addr:0x7f0"}true; + assume {:captureState "addr:l00001486"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #13, Gamma_#13 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#13, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#13); @@ -624,7 +624,7 @@ procedure main() } goto l000014b3; l000014b3: - assume {:captureState "addr:0x7fc"}true; + assume {:captureState "addr:l000014b3"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #14, Gamma_#14 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#14, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#14); @@ -637,7 +637,7 @@ procedure main() } goto l000014db; l000014db: - assume {:captureState "addr:0x808"}true; + assume {:captureState "addr:l000014db"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #15, Gamma_#15 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#15, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#15); @@ -650,7 +650,7 @@ procedure main() } goto l00001508; l00001508: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:l00001508"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #16, Gamma_#16 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#16, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#16); @@ -663,7 +663,7 @@ procedure main() } goto l00001530; l00001530: - assume {:captureState "addr:0x820"}true; + assume {:captureState "addr:l00001530"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #17, Gamma_#17 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#17, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#17); @@ -676,40 +676,40 @@ procedure main() } goto l00001564; l00001551: - assume {:captureState "addr:0x8c4"}true; + assume {:captureState "addr:l00001551"} true; R30, Gamma_R30 := 2248bv64, true; call add_six(); goto l0000155d; l0000155d: - assume {:captureState "addr:0x8c8"}true; + assume {:captureState "addr:l0000155d"} true; R30, Gamma_R30 := 2252bv64, true; call add_two(); goto l000014fc; l000014fc: - assume {:captureState "addr:0x8cc"}true; + assume {:captureState "addr:l000014fc"} true; R30, Gamma_R30 := 2256bv64, true; call add_six(); goto l000014a7; l000014a7: - assume {:captureState "addr:0x8d0"}true; + assume {:captureState "addr:l000014a7"} true; R30, Gamma_R30 := 2260bv64, true; call sub_seven(); goto l00001447; l00001447: - assume {:captureState "addr:0x8d4"}true; + assume {:captureState "addr:l00001447"} true; R30, Gamma_R30 := 2264bv64, true; call sub_seven(); goto l00001453; l00001453: - assume {:captureState "addr:0x8d8"}true; + assume {:captureState "addr:l00001453"} true; R30, Gamma_R30 := 2268bv64, true; call add_six(); goto l0000145a; l0000145a: - assume {:captureState "addr:0x8dc"}true; + assume {:captureState "addr:l0000145a"} true; goto l00001308; l00001564: - assume {:captureState "addr:0x82c"}true; + assume {:captureState "addr:l00001564"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #18, Gamma_#18 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#18, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#18); @@ -722,7 +722,7 @@ procedure main() } goto l0000158c; l0000158c: - assume {:captureState "addr:0x838"}true; + assume {:captureState "addr:l0000158c"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #19, Gamma_#19 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#19, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#19); @@ -735,15 +735,15 @@ procedure main() } goto l000015bd; l000015ad: - assume {:captureState "addr:0x8bc"}true; + assume {:captureState "addr:l000015ad"} true; R30, Gamma_R30 := 2240bv64, true; call add_six(); goto l000015b9; l000015b9: - assume {:captureState "addr:0x8c0"}true; + assume {:captureState "addr:l000015b9"} true; goto l00001308; l000015bd: - assume {:captureState "addr:0x844"}true; + assume {:captureState "addr:l000015bd"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #20, Gamma_#20 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#20, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#20); @@ -756,7 +756,7 @@ procedure main() } goto l000015e5; l000015e5: - assume {:captureState "addr:0x850"}true; + assume {:captureState "addr:l000015e5"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #21, Gamma_#21 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#21, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#21); @@ -769,20 +769,20 @@ procedure main() } goto l0000161d; l00001606: - assume {:captureState "addr:0x8b0"}true; + assume {:captureState "addr:l00001606"} true; R30, Gamma_R30 := 2228bv64, true; call add_two(); goto l00001612; l00001612: - assume {:captureState "addr:0x8b4"}true; + assume {:captureState "addr:l00001612"} true; R30, Gamma_R30 := 2232bv64, true; call sub_seven(); goto l00001619; l00001619: - assume {:captureState "addr:0x8b8"}true; + assume {:captureState "addr:l00001619"} true; goto l00001308; l0000161d: - assume {:captureState "addr:0x85c"}true; + assume {:captureState "addr:l0000161d"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #22, Gamma_#22 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#22, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#22); @@ -795,7 +795,7 @@ procedure main() } goto l00001645; l00001645: - assume {:captureState "addr:0x868"}true; + assume {:captureState "addr:l00001645"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #23, Gamma_#23 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#23, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#23); @@ -808,7 +808,7 @@ procedure main() } goto l00001676; l00001676: - assume {:captureState "addr:0x874"}true; + assume {:captureState "addr:l00001676"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #24, Gamma_#24 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#24, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#24); @@ -821,7 +821,7 @@ procedure main() } goto l0000169e; l0000169e: - assume {:captureState "addr:0x880"}true; + assume {:captureState "addr:l0000169e"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #25, Gamma_#25 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#25, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#25); @@ -834,15 +834,15 @@ procedure main() } goto l000016d6; l000016bf: - assume {:captureState "addr:0x89c"}true; + assume {:captureState "addr:l000016bf"} true; R30, Gamma_R30 := 2208bv64, true; call add_two(); goto l000016cb; l000016cb: - assume {:captureState "addr:0x8a0"}true; + assume {:captureState "addr:l000016cb"} true; goto l00001308; l000016d6: - assume {:captureState "addr:0x88c"}true; + assume {:captureState "addr:l000016d6"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #26, Gamma_#26 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#26, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#26); @@ -855,34 +855,34 @@ procedure main() } goto l000016fc; l000016cf: - assume {:captureState "addr:0x8a4"}true; + assume {:captureState "addr:l000016cf"} true; R30, Gamma_R30 := 2216bv64, true; call add_six(); goto l00001666; l00001666: - assume {:captureState "addr:0x8a8"}true; + assume {:captureState "addr:l00001666"} true; R30, Gamma_R30 := 2220bv64, true; call sub_seven(); goto l00001672; l00001672: - assume {:captureState "addr:0x8ac"}true; + assume {:captureState "addr:l00001672"} true; goto l00001308; l00001308: - assume {:captureState "addr:0x90c"}true; + assume {:captureState "addr:l00001308"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); goto l0000131d; l000016fc: - assume {:captureState "addr:0x898"}true; + assume {:captureState "addr:l000016fc"} true; goto l00001332; l00001332: - assume {:captureState "addr:0x904"}true; + assume {:captureState "addr:l00001332"} true; R0, Gamma_R0 := 1bv64, true; goto l0000131d; l0000131d: - assume {:captureState "addr:0x918"}true; + assume {:captureState "addr:l0000131d"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; @@ -965,7 +965,7 @@ procedure sub_seven() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lsub_seven: - assume {:captureState "addr:0x75c"}true; + assume {:captureState "addr:lsub_seven"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -976,6 +976,6 @@ procedure sub_seven() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x774"}true; + assume {:captureState "%0000129e"} true; return; } diff --git a/src/test/correct/jumptable3/gcc_pic/jumptable3.expected b/src/test/correct/jumptable3/gcc_pic/jumptable3.expected index 98d58c4b2..c69c316c7 100644 --- a/src/test/correct/jumptable3/gcc_pic/jumptable3.expected +++ b/src/test/correct/jumptable3/gcc_pic/jumptable3.expected @@ -1,69 +1,69 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"}bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -112,7 +112,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -121,9 +121,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure add_six() @@ -218,7 +218,7 @@ procedure add_six() free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { ladd_six: - assume {:captureState "addr:0x778"}true; + assume {:captureState "addr:ladd_six"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -231,7 +231,7 @@ procedure add_six() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x790"}true; + assume {:captureState "%00000515"} true; return; } @@ -327,7 +327,7 @@ procedure add_two() free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { ladd_two: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:ladd_two"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -340,7 +340,7 @@ procedure add_two() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x76c"}true; + assume {:captureState "%000004e1"} true; return; } @@ -515,18 +515,18 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x7c0"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x7c0"}true; + assume {:captureState "%0000055c"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x7c0"}true; + assume {:captureState "%00000562"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x7c8"}true; + assume {:captureState "%00000574"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); - assume {:captureState "addr:0x7cc"}true; + assume {:captureState "%0000057c"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967284bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934581bv33))), (Gamma_R0 && Gamma_#5); @@ -539,7 +539,7 @@ procedure main() } goto l000005e7; l000005e7: - assume {:captureState "addr:0x7dc"}true; + assume {:captureState "addr:l000005e7"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967284bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934581bv33))), (Gamma_R0 && Gamma_#6); @@ -552,7 +552,7 @@ procedure main() } goto l0000060f; l0000060f: - assume {:captureState "addr:0x7e8"}true; + assume {:captureState "addr:l0000060f"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #7, Gamma_#7 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#7); @@ -565,35 +565,35 @@ procedure main() } goto l0000064a; l00000630: - assume {:captureState "addr:0x92c"}true; + assume {:captureState "addr:l00000630"} true; R30, Gamma_R30 := 2352bv64, true; call sub_seven(); goto l0000063c; l0000063c: - assume {:captureState "addr:0x930"}true; + assume {:captureState "addr:l0000063c"} true; R30, Gamma_R30 := 2356bv64, true; call add_two(); goto l00000643; l00000643: - assume {:captureState "addr:0x934"}true; + assume {:captureState "addr:l00000643"} true; R30, Gamma_R30 := 2360bv64, true; call add_six(); goto l0000059f; l0000059f: - assume {:captureState "addr:0x938"}true; + assume {:captureState "addr:l0000059f"} true; R30, Gamma_R30 := 2364bv64, true; call sub_seven(); goto l000005ab; l000005ab: - assume {:captureState "addr:0x93c"}true; + assume {:captureState "addr:l000005ab"} true; R30, Gamma_R30 := 2368bv64, true; call add_two(); goto l000005b2; l000005b2: - assume {:captureState "addr:0x940"}true; + assume {:captureState "addr:l000005b2"} true; goto l000005b3; l0000064a: - assume {:captureState "addr:0x7f4"}true; + assume {:captureState "addr:l0000064a"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #8, Gamma_#8 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#8); @@ -606,7 +606,7 @@ procedure main() } goto l00000672; l00000672: - assume {:captureState "addr:0x800"}true; + assume {:captureState "addr:l00000672"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #9, Gamma_#9 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#9); @@ -619,20 +619,20 @@ procedure main() } goto l000006aa; l00000693: - assume {:captureState "addr:0x920"}true; + assume {:captureState "addr:l00000693"} true; R30, Gamma_R30 := 2340bv64, true; call add_two(); goto l0000069f; l0000069f: - assume {:captureState "addr:0x924"}true; + assume {:captureState "addr:l0000069f"} true; R30, Gamma_R30 := 2344bv64, true; call add_six(); goto l000006a6; l000006a6: - assume {:captureState "addr:0x928"}true; + assume {:captureState "addr:l000006a6"} true; goto l000005b3; l000006aa: - assume {:captureState "addr:0x80c"}true; + assume {:captureState "addr:l000006aa"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #10, Gamma_#10 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#10); @@ -645,7 +645,7 @@ procedure main() } goto l000006d2; l000006d2: - assume {:captureState "addr:0x818"}true; + assume {:captureState "addr:l000006d2"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #11, Gamma_#11 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#11); @@ -658,7 +658,7 @@ procedure main() } goto l0000070a; l0000070a: - assume {:captureState "addr:0x824"}true; + assume {:captureState "addr:l0000070a"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #12, Gamma_#12 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#12); @@ -671,7 +671,7 @@ procedure main() } goto l00000732; l00000732: - assume {:captureState "addr:0x830"}true; + assume {:captureState "addr:l00000732"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #13, Gamma_#13 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#13, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#13); @@ -684,7 +684,7 @@ procedure main() } goto l0000075f; l0000075f: - assume {:captureState "addr:0x83c"}true; + assume {:captureState "addr:l0000075f"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #14, Gamma_#14 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#14, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#14); @@ -697,7 +697,7 @@ procedure main() } goto l00000787; l00000787: - assume {:captureState "addr:0x848"}true; + assume {:captureState "addr:l00000787"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #15, Gamma_#15 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#15, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#15); @@ -710,7 +710,7 @@ procedure main() } goto l000007b4; l000007b4: - assume {:captureState "addr:0x854"}true; + assume {:captureState "addr:l000007b4"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #16, Gamma_#16 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#16, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#16); @@ -723,7 +723,7 @@ procedure main() } goto l000007dc; l000007dc: - assume {:captureState "addr:0x860"}true; + assume {:captureState "addr:l000007dc"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #17, Gamma_#17 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#17, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#17); @@ -736,40 +736,40 @@ procedure main() } goto l00000810; l000007fd: - assume {:captureState "addr:0x904"}true; + assume {:captureState "addr:l000007fd"} true; R30, Gamma_R30 := 2312bv64, true; call add_six(); goto l00000809; l00000809: - assume {:captureState "addr:0x908"}true; + assume {:captureState "addr:l00000809"} true; R30, Gamma_R30 := 2316bv64, true; call add_two(); goto l000007a8; l000007a8: - assume {:captureState "addr:0x90c"}true; + assume {:captureState "addr:l000007a8"} true; R30, Gamma_R30 := 2320bv64, true; call add_six(); goto l00000753; l00000753: - assume {:captureState "addr:0x910"}true; + assume {:captureState "addr:l00000753"} true; R30, Gamma_R30 := 2324bv64, true; call sub_seven(); goto l000006f3; l000006f3: - assume {:captureState "addr:0x914"}true; + assume {:captureState "addr:l000006f3"} true; R30, Gamma_R30 := 2328bv64, true; call sub_seven(); goto l000006ff; l000006ff: - assume {:captureState "addr:0x918"}true; + assume {:captureState "addr:l000006ff"} true; R30, Gamma_R30 := 2332bv64, true; call add_six(); goto l00000706; l00000706: - assume {:captureState "addr:0x91c"}true; + assume {:captureState "addr:l00000706"} true; goto l000005b3; l00000810: - assume {:captureState "addr:0x86c"}true; + assume {:captureState "addr:l00000810"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #18, Gamma_#18 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#18, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#18); @@ -782,7 +782,7 @@ procedure main() } goto l00000838; l00000838: - assume {:captureState "addr:0x878"}true; + assume {:captureState "addr:l00000838"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #19, Gamma_#19 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#19, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#19); @@ -795,15 +795,15 @@ procedure main() } goto l00000869; l00000859: - assume {:captureState "addr:0x8fc"}true; + assume {:captureState "addr:l00000859"} true; R30, Gamma_R30 := 2304bv64, true; call add_six(); goto l00000865; l00000865: - assume {:captureState "addr:0x900"}true; + assume {:captureState "addr:l00000865"} true; goto l000005b3; l00000869: - assume {:captureState "addr:0x884"}true; + assume {:captureState "addr:l00000869"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #20, Gamma_#20 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#20, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#20); @@ -816,7 +816,7 @@ procedure main() } goto l00000891; l00000891: - assume {:captureState "addr:0x890"}true; + assume {:captureState "addr:l00000891"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #21, Gamma_#21 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#21, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#21); @@ -829,20 +829,20 @@ procedure main() } goto l000008c9; l000008b2: - assume {:captureState "addr:0x8f0"}true; + assume {:captureState "addr:l000008b2"} true; R30, Gamma_R30 := 2292bv64, true; call add_two(); goto l000008be; l000008be: - assume {:captureState "addr:0x8f4"}true; + assume {:captureState "addr:l000008be"} true; R30, Gamma_R30 := 2296bv64, true; call sub_seven(); goto l000008c5; l000008c5: - assume {:captureState "addr:0x8f8"}true; + assume {:captureState "addr:l000008c5"} true; goto l000005b3; l000008c9: - assume {:captureState "addr:0x89c"}true; + assume {:captureState "addr:l000008c9"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #22, Gamma_#22 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#22, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#22); @@ -855,7 +855,7 @@ procedure main() } goto l000008f1; l000008f1: - assume {:captureState "addr:0x8a8"}true; + assume {:captureState "addr:l000008f1"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #23, Gamma_#23 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#23, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#23); @@ -868,7 +868,7 @@ procedure main() } goto l00000922; l00000922: - assume {:captureState "addr:0x8b4"}true; + assume {:captureState "addr:l00000922"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #24, Gamma_#24 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#24, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#24); @@ -881,7 +881,7 @@ procedure main() } goto l0000094a; l0000094a: - assume {:captureState "addr:0x8c0"}true; + assume {:captureState "addr:l0000094a"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #25, Gamma_#25 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#25, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#25); @@ -894,15 +894,15 @@ procedure main() } goto l00000982; l0000096b: - assume {:captureState "addr:0x8dc"}true; + assume {:captureState "addr:l0000096b"} true; R30, Gamma_R30 := 2272bv64, true; call add_two(); goto l00000977; l00000977: - assume {:captureState "addr:0x8e0"}true; + assume {:captureState "addr:l00000977"} true; goto l000005b3; l00000982: - assume {:captureState "addr:0x8cc"}true; + assume {:captureState "addr:l00000982"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #26, Gamma_#26 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#26, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#26); @@ -915,20 +915,20 @@ procedure main() } goto l000009a8; l0000097b: - assume {:captureState "addr:0x8e4"}true; + assume {:captureState "addr:l0000097b"} true; R30, Gamma_R30 := 2280bv64, true; call add_six(); goto l00000912; l00000912: - assume {:captureState "addr:0x8e8"}true; + assume {:captureState "addr:l00000912"} true; R30, Gamma_R30 := 2284bv64, true; call sub_seven(); goto l0000091e; l0000091e: - assume {:captureState "addr:0x8ec"}true; + assume {:captureState "addr:l0000091e"} true; goto l000005b3; l000005b3: - assume {:captureState "addr:0x94c"}true; + assume {:captureState "addr:l000005b3"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -936,14 +936,14 @@ procedure main() R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); goto l000005c9; l000009a8: - assume {:captureState "addr:0x8d8"}true; + assume {:captureState "addr:l000009a8"} true; goto l000005de; l000005de: - assume {:captureState "addr:0x944"}true; + assume {:captureState "addr:l000005de"} true; R0, Gamma_R0 := 1bv64, true; goto l000005c9; l000005c9: - assume {:captureState "addr:0x958"}true; + assume {:captureState "addr:l000005c9"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; @@ -1042,7 +1042,7 @@ procedure sub_seven() free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { lsub_seven: - assume {:captureState "addr:0x79c"}true; + assume {:captureState "addr:lsub_seven"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -1055,6 +1055,6 @@ procedure sub_seven() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x7b4"}true; + assume {:captureState "%00000549"} true; return; } diff --git a/src/test/correct/malloc_with_local/clang/malloc_with_local.expected b/src/test/correct/malloc_with_local/clang/malloc_with_local.expected index 1883bb73b..ce31f45fd 100644 --- a/src/test/correct/malloc_with_local/clang/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/clang/malloc_with_local.expected @@ -1,83 +1,83 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2256bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2256bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,9 +187,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -607,50 +607,50 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000362"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000368"} true; R29, Gamma_R29 := bvadd64(R31, 32bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, R31, R8[32:0]), gamma_store32(Gamma_stack, R31, Gamma_R8); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%0000037b"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); - assume {:captureState "addr:0x828"}true; + assume {:captureState "%00000382"} true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000391; l00000391: - assume {:captureState "addr:0x834"}true; + assume {:captureState "addr:l00000391"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); - assume {:captureState "addr:0x834"}true; + assume {:captureState "%00000397"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2112bv64, true; call malloc(); goto l000003a5; l000003a5: - assume {:captureState "addr:0x840"}true; + assume {:captureState "addr:l000003a5"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x840"}true; + assume {:captureState "%000003ab"} true; R8, Gamma_R8 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x848"}true; + assume {:captureState "%000003b8"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x854"}true; + assume {:captureState "%000003cc"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x860"}true; + assume {:captureState "%000003e0"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -660,7 +660,7 @@ procedure main() call printf(); goto l00000403; l00000403: - assume {:captureState "addr:0x878"}true; + assume {:captureState "addr:l00000403"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -670,7 +670,7 @@ procedure main() call printf(); goto l00000423; l00000423: - assume {:captureState "addr:0x88c"}true; + assume {:captureState "addr:l00000423"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2293bv64), Gamma_R0; @@ -678,19 +678,19 @@ procedure main() call printf(); goto l0000043c; l0000043c: - assume {:captureState "addr:0x89c"}true; + assume {:captureState "addr:l0000043c"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2212bv64, true; call #free(); goto l0000044b; l0000044b: - assume {:captureState "addr:0x8a4"}true; + assume {:captureState "addr:l0000044b"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2220bv64, true; call #free(); goto l00000459; l00000459: - assume {:captureState "addr:0x8ac"}true; + assume {:captureState "addr:l00000459"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, R31)), gamma_load32(Gamma_stack, R31); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/malloc_with_local/clang_O2/malloc_with_local.expected b/src/test/correct/malloc_with_local/clang_O2/malloc_with_local.expected index 9d23a723c..6e1fa0e08 100644 --- a/src/test/correct/malloc_with_local/clang_O2/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/clang_O2/malloc_with_local.expected @@ -1,45 +1,45 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1964bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1964bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -140,7 +140,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -149,9 +149,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -372,12 +372,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000002f8"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000002fe"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 0bv64, true; @@ -387,7 +387,7 @@ procedure main() call printf(); goto l00000322; l00000322: - assume {:captureState "addr:0x76c"}true; + assume {:captureState "addr:l00000322"} true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 1985bv64), Gamma_R0; R1, Gamma_R1 := 42bv64, true; @@ -395,7 +395,7 @@ procedure main() call printf(); goto l00000339; l00000339: - assume {:captureState "addr:0x77c"}true; + assume {:captureState "addr:l00000339"} true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2001bv64), Gamma_R0; R1, Gamma_R1 := 10bv64, true; @@ -403,7 +403,7 @@ procedure main() call printf(); goto l00000350; l00000350: - assume {:captureState "addr:0x78c"}true; + assume {:captureState "addr:l00000350"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local/clang_no_plt_no_pic/malloc_with_local.expected b/src/test/correct/malloc_with_local/clang_no_plt_no_pic/malloc_with_local.expected index 4ebaee775..c70421f04 100644 --- a/src/test/correct/malloc_with_local/clang_no_plt_no_pic/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/clang_no_plt_no_pic/malloc_with_local.expected @@ -1,83 +1,83 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2256bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2256bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,9 +187,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -607,50 +607,50 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000ad4"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000ada"} true; R29, Gamma_R29 := bvadd64(R31, 32bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, R31, R8[32:0]), gamma_store32(Gamma_stack, R31, Gamma_R8); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000aed"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); - assume {:captureState "addr:0x828"}true; + assume {:captureState "%00000af4"} true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000b03; l00000b03: - assume {:captureState "addr:0x834"}true; + assume {:captureState "addr:l00000b03"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); - assume {:captureState "addr:0x834"}true; + assume {:captureState "%00000b09"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2112bv64, true; call malloc(); goto l00000b17; l00000b17: - assume {:captureState "addr:0x840"}true; + assume {:captureState "addr:l00000b17"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x840"}true; + assume {:captureState "%00000b1d"} true; R8, Gamma_R8 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x848"}true; + assume {:captureState "%00000b2a"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x854"}true; + assume {:captureState "%00000b3e"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x860"}true; + assume {:captureState "%00000b52"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -660,7 +660,7 @@ procedure main() call printf(); goto l00000b75; l00000b75: - assume {:captureState "addr:0x878"}true; + assume {:captureState "addr:l00000b75"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -670,7 +670,7 @@ procedure main() call printf(); goto l00000b95; l00000b95: - assume {:captureState "addr:0x88c"}true; + assume {:captureState "addr:l00000b95"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2293bv64), Gamma_R0; @@ -678,19 +678,19 @@ procedure main() call printf(); goto l00000bae; l00000bae: - assume {:captureState "addr:0x89c"}true; + assume {:captureState "addr:l00000bae"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2212bv64, true; call #free(); goto l00000bbd; l00000bbd: - assume {:captureState "addr:0x8a4"}true; + assume {:captureState "addr:l00000bbd"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2220bv64, true; call #free(); goto l00000bcb; l00000bcb: - assume {:captureState "addr:0x8ac"}true; + assume {:captureState "addr:l00000bcb"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, R31)), gamma_load32(Gamma_stack, R31); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/malloc_with_local/clang_pic/malloc_with_local.expected b/src/test/correct/malloc_with_local/clang_pic/malloc_with_local.expected index 4ebaee775..c70421f04 100644 --- a/src/test/correct/malloc_with_local/clang_pic/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/clang_pic/malloc_with_local.expected @@ -1,83 +1,83 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2256bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2256bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,9 +187,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -607,50 +607,50 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000ad4"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000ada"} true; R29, Gamma_R29 := bvadd64(R31, 32bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, R31, R8[32:0]), gamma_store32(Gamma_stack, R31, Gamma_R8); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000aed"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); - assume {:captureState "addr:0x828"}true; + assume {:captureState "%00000af4"} true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000b03; l00000b03: - assume {:captureState "addr:0x834"}true; + assume {:captureState "addr:l00000b03"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); - assume {:captureState "addr:0x834"}true; + assume {:captureState "%00000b09"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2112bv64, true; call malloc(); goto l00000b17; l00000b17: - assume {:captureState "addr:0x840"}true; + assume {:captureState "addr:l00000b17"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x840"}true; + assume {:captureState "%00000b1d"} true; R8, Gamma_R8 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x848"}true; + assume {:captureState "%00000b2a"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x854"}true; + assume {:captureState "%00000b3e"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x860"}true; + assume {:captureState "%00000b52"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -660,7 +660,7 @@ procedure main() call printf(); goto l00000b75; l00000b75: - assume {:captureState "addr:0x878"}true; + assume {:captureState "addr:l00000b75"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -670,7 +670,7 @@ procedure main() call printf(); goto l00000b95; l00000b95: - assume {:captureState "addr:0x88c"}true; + assume {:captureState "addr:l00000b95"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2293bv64), Gamma_R0; @@ -678,19 +678,19 @@ procedure main() call printf(); goto l00000bae; l00000bae: - assume {:captureState "addr:0x89c"}true; + assume {:captureState "addr:l00000bae"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2212bv64, true; call #free(); goto l00000bbd; l00000bbd: - assume {:captureState "addr:0x8a4"}true; + assume {:captureState "addr:l00000bbd"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2220bv64, true; call #free(); goto l00000bcb; l00000bcb: - assume {:captureState "addr:0x8ac"}true; + assume {:captureState "addr:l00000bcb"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, R31)), gamma_load32(Gamma_stack, R31); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/malloc_with_local/gcc/malloc_with_local.expected b/src/test/correct/malloc_with_local/gcc/malloc_with_local.expected index c8c8180d9..2219ee6ab 100644 --- a/src/test/correct/malloc_with_local/gcc/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/gcc/malloc_with_local.expected @@ -1,79 +1,79 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2248bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2248bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,9 +194,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -656,12 +656,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000350"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000356"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -669,32 +669,32 @@ procedure main() call malloc(); goto l0000036f; l0000036f: - assume {:captureState "addr:0x824"}true; + assume {:captureState "addr:l0000036f"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000375"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2096bv64, true; call malloc(); goto l00000383; l00000383: - assume {:captureState "addr:0x830"}true; + assume {:captureState "addr:l00000383"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); - assume {:captureState "addr:0x830"}true; + assume {:captureState "%00000389"} true; R0, Gamma_R0 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x838"}true; + assume {:captureState "%00000396"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x844"}true; + assume {:captureState "%000003aa"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x850"}true; + assume {:captureState "%000003be"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -705,7 +705,7 @@ procedure main() call printf(); goto l000003e7; l000003e7: - assume {:captureState "addr:0x86c"}true; + assume {:captureState "addr:l000003e7"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -716,7 +716,7 @@ procedure main() call printf(); goto l0000040d; l0000040d: - assume {:captureState "addr:0x884"}true; + assume {:captureState "addr:l0000040d"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2296bv64), Gamma_R0; @@ -724,19 +724,19 @@ procedure main() call printf(); goto l00000426; l00000426: - assume {:captureState "addr:0x894"}true; + assume {:captureState "addr:l00000426"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2204bv64, true; call #free(); goto l00000435; l00000435: - assume {:captureState "addr:0x89c"}true; + assume {:captureState "addr:l00000435"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2212bv64, true; call #free(); goto l00000443; l00000443: - assume {:captureState "addr:0x8a4"}true; + assume {:captureState "addr:l00000443"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local/gcc_O2/malloc_with_local.expected b/src/test/correct/malloc_with_local/gcc_O2/malloc_with_local.expected index 023c5c714..e680279cb 100644 --- a/src/test/correct/malloc_with_local/gcc_O2/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/gcc_O2/malloc_with_local.expected @@ -1,47 +1,47 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R2: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2088bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2088bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -153,7 +153,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -162,9 +162,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure __printf_chk(); @@ -624,12 +624,12 @@ procedure main() var #1: bv64; var Gamma_#1: bool; lmain: - assume {:captureState "addr:0x680"}true; + assume {:captureState "addr:lmain"} true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); - assume {:captureState "addr:0x680"}true; + assume {:captureState "%000001f2"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#1, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#1, 8bv64), Gamma_R30); - assume {:captureState "addr:0x680"}true; + assume {:captureState "%000001f8"} true; R31, Gamma_R31 := #1, Gamma_#1; R2, Gamma_R2 := 65bv64, true; R1, Gamma_R1 := 0bv64, true; @@ -640,7 +640,7 @@ procedure main() call __printf_chk(); goto l00000221; l00000221: - assume {:captureState "addr:0x69c"}true; + assume {:captureState "addr:l00000221"} true; R2, Gamma_R2 := 42bv64, true; R1, Gamma_R1 := 0bv64, true; R0, Gamma_R0 := 1bv64, true; @@ -649,7 +649,7 @@ procedure main() call __printf_chk(); goto l0000023d; l0000023d: - assume {:captureState "addr:0x6b0"}true; + assume {:captureState "addr:l0000023d"} true; R2, Gamma_R2 := 10bv64, true; R1, Gamma_R1 := 0bv64, true; R0, Gamma_R0 := 1bv64, true; @@ -658,7 +658,7 @@ procedure main() call __printf_chk(); goto l00000259; l00000259: - assume {:captureState "addr:0x6c4"}true; + assume {:captureState "addr:l00000259"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local/gcc_no_plt_no_pic/malloc_with_local.expected b/src/test/correct/malloc_with_local/gcc_no_plt_no_pic/malloc_with_local.expected index 438bb13d4..d4716b196 100644 --- a/src/test/correct/malloc_with_local/gcc_no_plt_no_pic/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/gcc_no_plt_no_pic/malloc_with_local.expected @@ -1,79 +1,79 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2248bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2248bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,9 +194,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -656,12 +656,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000aa1"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000aa7"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -669,32 +669,32 @@ procedure main() call malloc(); goto l00000ac0; l00000ac0: - assume {:captureState "addr:0x824"}true; + assume {:captureState "addr:l00000ac0"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000ac6"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2096bv64, true; call malloc(); goto l00000ad4; l00000ad4: - assume {:captureState "addr:0x830"}true; + assume {:captureState "addr:l00000ad4"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); - assume {:captureState "addr:0x830"}true; + assume {:captureState "%00000ada"} true; R0, Gamma_R0 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x838"}true; + assume {:captureState "%00000ae7"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x844"}true; + assume {:captureState "%00000afb"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x850"}true; + assume {:captureState "%00000b0f"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -705,7 +705,7 @@ procedure main() call printf(); goto l00000b38; l00000b38: - assume {:captureState "addr:0x86c"}true; + assume {:captureState "addr:l00000b38"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -716,7 +716,7 @@ procedure main() call printf(); goto l00000b5e; l00000b5e: - assume {:captureState "addr:0x884"}true; + assume {:captureState "addr:l00000b5e"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2296bv64), Gamma_R0; @@ -724,19 +724,19 @@ procedure main() call printf(); goto l00000b77; l00000b77: - assume {:captureState "addr:0x894"}true; + assume {:captureState "addr:l00000b77"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2204bv64, true; call #free(); goto l00000b86; l00000b86: - assume {:captureState "addr:0x89c"}true; + assume {:captureState "addr:l00000b86"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2212bv64, true; call #free(); goto l00000b94; l00000b94: - assume {:captureState "addr:0x8a4"}true; + assume {:captureState "addr:l00000b94"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local/gcc_pic/malloc_with_local.expected b/src/test/correct/malloc_with_local/gcc_pic/malloc_with_local.expected index 438bb13d4..d4716b196 100644 --- a/src/test/correct/malloc_with_local/gcc_pic/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/gcc_pic/malloc_with_local.expected @@ -1,79 +1,79 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2248bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2248bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,9 +194,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -656,12 +656,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000aa1"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000aa7"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -669,32 +669,32 @@ procedure main() call malloc(); goto l00000ac0; l00000ac0: - assume {:captureState "addr:0x824"}true; + assume {:captureState "addr:l00000ac0"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000ac6"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2096bv64, true; call malloc(); goto l00000ad4; l00000ad4: - assume {:captureState "addr:0x830"}true; + assume {:captureState "addr:l00000ad4"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); - assume {:captureState "addr:0x830"}true; + assume {:captureState "%00000ada"} true; R0, Gamma_R0 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x838"}true; + assume {:captureState "%00000ae7"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x844"}true; + assume {:captureState "%00000afb"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x850"}true; + assume {:captureState "%00000b0f"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -705,7 +705,7 @@ procedure main() call printf(); goto l00000b38; l00000b38: - assume {:captureState "addr:0x86c"}true; + assume {:captureState "addr:l00000b38"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -716,7 +716,7 @@ procedure main() call printf(); goto l00000b5e; l00000b5e: - assume {:captureState "addr:0x884"}true; + assume {:captureState "addr:l00000b5e"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2296bv64), Gamma_R0; @@ -724,19 +724,19 @@ procedure main() call printf(); goto l00000b77; l00000b77: - assume {:captureState "addr:0x894"}true; + assume {:captureState "addr:l00000b77"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2204bv64, true; call #free(); goto l00000b86; l00000b86: - assume {:captureState "addr:0x89c"}true; + assume {:captureState "addr:l00000b86"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2212bv64, true; call #free(); goto l00000b94; l00000b94: - assume {:captureState "addr:0x8a4"}true; + assume {:captureState "addr:l00000b94"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local2/clang/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/clang/malloc_with_local2.expected index 6e3304845..7b71ddd4c 100644 --- a/src/test/correct/malloc_with_local2/clang/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/clang/malloc_with_local2.expected @@ -1,83 +1,83 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2292bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2292bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,9 +187,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -607,67 +607,67 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000386"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%0000038c"} true; R29, Gamma_R29 := bvadd64(R31, 64bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%0000039f"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); - assume {:captureState "addr:0x828"}true; + assume {:captureState "%000003a6"} true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l000003b5; l000003b5: - assume {:captureState "addr:0x834"}true; + assume {:captureState "addr:l000003b5"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R29, 18446744073709551600bv64), R0), gamma_store64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64), Gamma_R0); - assume {:captureState "addr:0x834"}true; + assume {:captureState "%000003bb"} true; R8, Gamma_R8 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551596bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551596bv64), Gamma_R8); - assume {:captureState "addr:0x83c"}true; + assume {:captureState "%000003c8"} true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store64_le(stack, R31, R0), gamma_store64(Gamma_stack, R31, Gamma_R0); - assume {:captureState "addr:0x844"}true; + assume {:captureState "%000003d5"} true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l000003de; l000003de: - assume {:captureState "addr:0x84c"}true; + assume {:captureState "addr:l000003de"} true; R8, Gamma_R8 := R0, Gamma_R0; R0, Gamma_R0 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R8); - assume {:captureState "addr:0x854"}true; + assume {:captureState "%000003f1"} true; R8, Gamma_R8 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R8); - assume {:captureState "addr:0x85c"}true; + assume {:captureState "%000003fe"} true; R30, Gamma_R30 := 2148bv64, true; call malloc(); goto l00000407; l00000407: - assume {:captureState "addr:0x864"}true; + assume {:captureState "addr:l00000407"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); - assume {:captureState "addr:0x864"}true; + assume {:captureState "%0000040d"} true; R8, Gamma_R8 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x86c"}true; + assume {:captureState "%0000041a"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x878"}true; + assume {:captureState "%0000042e"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x884"}true; + assume {:captureState "%00000442"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -677,7 +677,7 @@ procedure main() call printf(); goto l00000465; l00000465: - assume {:captureState "addr:0x89c"}true; + assume {:captureState "addr:l00000465"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -687,7 +687,7 @@ procedure main() call printf(); goto l00000485; l00000485: - assume {:captureState "addr:0x8b0"}true; + assume {:captureState "addr:l00000485"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2329bv64), Gamma_R0; @@ -695,19 +695,19 @@ procedure main() call printf(); goto l0000049e; l0000049e: - assume {:captureState "addr:0x8c0"}true; + assume {:captureState "addr:l0000049e"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2248bv64, true; call #free(); goto l000004ad; l000004ad: - assume {:captureState "addr:0x8c8"}true; + assume {:captureState "addr:l000004ad"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2256bv64, true; call #free(); goto l000004bb; l000004bb: - assume {:captureState "addr:0x8d0"}true; + assume {:captureState "addr:l000004bb"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd64(R31, 64bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/malloc_with_local2/clang_O2/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/clang_O2/malloc_with_local2.expected index 9d23a723c..6e1fa0e08 100644 --- a/src/test/correct/malloc_with_local2/clang_O2/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/clang_O2/malloc_with_local2.expected @@ -1,45 +1,45 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1964bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1964bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -140,7 +140,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -149,9 +149,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -372,12 +372,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000002f8"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000002fe"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 0bv64, true; @@ -387,7 +387,7 @@ procedure main() call printf(); goto l00000322; l00000322: - assume {:captureState "addr:0x76c"}true; + assume {:captureState "addr:l00000322"} true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 1985bv64), Gamma_R0; R1, Gamma_R1 := 42bv64, true; @@ -395,7 +395,7 @@ procedure main() call printf(); goto l00000339; l00000339: - assume {:captureState "addr:0x77c"}true; + assume {:captureState "addr:l00000339"} true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2001bv64), Gamma_R0; R1, Gamma_R1 := 10bv64, true; @@ -403,7 +403,7 @@ procedure main() call printf(); goto l00000350; l00000350: - assume {:captureState "addr:0x78c"}true; + assume {:captureState "addr:l00000350"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local2/clang_no_plt_no_pic/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/clang_no_plt_no_pic/malloc_with_local2.expected index b677f7d99..29511831b 100644 --- a/src/test/correct/malloc_with_local2/clang_no_plt_no_pic/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/clang_no_plt_no_pic/malloc_with_local2.expected @@ -1,83 +1,83 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2292bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2292bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,9 +187,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -607,67 +607,67 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000b63"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000b69"} true; R29, Gamma_R29 := bvadd64(R31, 64bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000b7c"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); - assume {:captureState "addr:0x828"}true; + assume {:captureState "%00000b83"} true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000b92; l00000b92: - assume {:captureState "addr:0x834"}true; + assume {:captureState "addr:l00000b92"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R29, 18446744073709551600bv64), R0), gamma_store64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64), Gamma_R0); - assume {:captureState "addr:0x834"}true; + assume {:captureState "%00000b98"} true; R8, Gamma_R8 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551596bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551596bv64), Gamma_R8); - assume {:captureState "addr:0x83c"}true; + assume {:captureState "%00000ba5"} true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store64_le(stack, R31, R0), gamma_store64(Gamma_stack, R31, Gamma_R0); - assume {:captureState "addr:0x844"}true; + assume {:captureState "%00000bb2"} true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000bbb; l00000bbb: - assume {:captureState "addr:0x84c"}true; + assume {:captureState "addr:l00000bbb"} true; R8, Gamma_R8 := R0, Gamma_R0; R0, Gamma_R0 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R8); - assume {:captureState "addr:0x854"}true; + assume {:captureState "%00000bce"} true; R8, Gamma_R8 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R8); - assume {:captureState "addr:0x85c"}true; + assume {:captureState "%00000bdb"} true; R30, Gamma_R30 := 2148bv64, true; call malloc(); goto l00000be4; l00000be4: - assume {:captureState "addr:0x864"}true; + assume {:captureState "addr:l00000be4"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); - assume {:captureState "addr:0x864"}true; + assume {:captureState "%00000bea"} true; R8, Gamma_R8 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x86c"}true; + assume {:captureState "%00000bf7"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x878"}true; + assume {:captureState "%00000c0b"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x884"}true; + assume {:captureState "%00000c1f"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -677,7 +677,7 @@ procedure main() call printf(); goto l00000c42; l00000c42: - assume {:captureState "addr:0x89c"}true; + assume {:captureState "addr:l00000c42"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -687,7 +687,7 @@ procedure main() call printf(); goto l00000c62; l00000c62: - assume {:captureState "addr:0x8b0"}true; + assume {:captureState "addr:l00000c62"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2329bv64), Gamma_R0; @@ -695,19 +695,19 @@ procedure main() call printf(); goto l00000c7b; l00000c7b: - assume {:captureState "addr:0x8c0"}true; + assume {:captureState "addr:l00000c7b"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2248bv64, true; call #free(); goto l00000c8a; l00000c8a: - assume {:captureState "addr:0x8c8"}true; + assume {:captureState "addr:l00000c8a"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2256bv64, true; call #free(); goto l00000c98; l00000c98: - assume {:captureState "addr:0x8d0"}true; + assume {:captureState "addr:l00000c98"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd64(R31, 64bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/malloc_with_local2/clang_pic/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/clang_pic/malloc_with_local2.expected index b677f7d99..29511831b 100644 --- a/src/test/correct/malloc_with_local2/clang_pic/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/clang_pic/malloc_with_local2.expected @@ -1,83 +1,83 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2292bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2292bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,9 +187,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -607,67 +607,67 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000b63"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000b69"} true; R29, Gamma_R29 := bvadd64(R31, 64bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000b7c"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); - assume {:captureState "addr:0x828"}true; + assume {:captureState "%00000b83"} true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000b92; l00000b92: - assume {:captureState "addr:0x834"}true; + assume {:captureState "addr:l00000b92"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R29, 18446744073709551600bv64), R0), gamma_store64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64), Gamma_R0); - assume {:captureState "addr:0x834"}true; + assume {:captureState "%00000b98"} true; R8, Gamma_R8 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551596bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551596bv64), Gamma_R8); - assume {:captureState "addr:0x83c"}true; + assume {:captureState "%00000ba5"} true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store64_le(stack, R31, R0), gamma_store64(Gamma_stack, R31, Gamma_R0); - assume {:captureState "addr:0x844"}true; + assume {:captureState "%00000bb2"} true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000bbb; l00000bbb: - assume {:captureState "addr:0x84c"}true; + assume {:captureState "addr:l00000bbb"} true; R8, Gamma_R8 := R0, Gamma_R0; R0, Gamma_R0 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R8); - assume {:captureState "addr:0x854"}true; + assume {:captureState "%00000bce"} true; R8, Gamma_R8 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R8); - assume {:captureState "addr:0x85c"}true; + assume {:captureState "%00000bdb"} true; R30, Gamma_R30 := 2148bv64, true; call malloc(); goto l00000be4; l00000be4: - assume {:captureState "addr:0x864"}true; + assume {:captureState "addr:l00000be4"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); - assume {:captureState "addr:0x864"}true; + assume {:captureState "%00000bea"} true; R8, Gamma_R8 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x86c"}true; + assume {:captureState "%00000bf7"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x878"}true; + assume {:captureState "%00000c0b"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x884"}true; + assume {:captureState "%00000c1f"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -677,7 +677,7 @@ procedure main() call printf(); goto l00000c42; l00000c42: - assume {:captureState "addr:0x89c"}true; + assume {:captureState "addr:l00000c42"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -687,7 +687,7 @@ procedure main() call printf(); goto l00000c62; l00000c62: - assume {:captureState "addr:0x8b0"}true; + assume {:captureState "addr:l00000c62"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2329bv64), Gamma_R0; @@ -695,19 +695,19 @@ procedure main() call printf(); goto l00000c7b; l00000c7b: - assume {:captureState "addr:0x8c0"}true; + assume {:captureState "addr:l00000c7b"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2248bv64, true; call #free(); goto l00000c8a; l00000c8a: - assume {:captureState "addr:0x8c8"}true; + assume {:captureState "addr:l00000c8a"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2256bv64, true; call #free(); goto l00000c98; l00000c98: - assume {:captureState "addr:0x8d0"}true; + assume {:captureState "addr:l00000c98"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd64(R31, 64bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/malloc_with_local2/gcc/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/gcc/malloc_with_local2.expected index a749b374b..ed0d462a6 100644 --- a/src/test/correct/malloc_with_local2/gcc/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/gcc/malloc_with_local2.expected @@ -1,79 +1,79 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2272bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2272bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,9 +194,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -656,12 +656,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%0000036c"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000372"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -669,46 +669,46 @@ procedure main() call malloc(); goto l0000038b; l0000038b: - assume {:captureState "addr:0x824"}true; + assume {:captureState "addr:l0000038b"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000391"} true; R0, Gamma_R0 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x82c"}true; + assume {:captureState "%0000039e"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2104bv64, true; call malloc(); goto l000003ac; l000003ac: - assume {:captureState "addr:0x838"}true; + assume {:captureState "addr:l000003ac"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 48bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 48bv64), Gamma_R0); - assume {:captureState "addr:0x838"}true; + assume {:captureState "%000003b2"} true; R0, Gamma_R0 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 32bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); - assume {:captureState "addr:0x840"}true; + assume {:captureState "%000003bf"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l000003cd; l000003cd: - assume {:captureState "addr:0x84c"}true; + assume {:captureState "addr:l000003cd"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 56bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 56bv64), Gamma_R0); - assume {:captureState "addr:0x84c"}true; + assume {:captureState "%000003d3"} true; R0, Gamma_R0 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 36bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 36bv64), Gamma_R0); - assume {:captureState "addr:0x854"}true; + assume {:captureState "%000003e0"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x860"}true; + assume {:captureState "%000003f4"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x86c"}true; + assume {:captureState "%00000408"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -719,7 +719,7 @@ procedure main() call printf(); goto l00000431; l00000431: - assume {:captureState "addr:0x888"}true; + assume {:captureState "addr:l00000431"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -730,7 +730,7 @@ procedure main() call printf(); goto l00000457; l00000457: - assume {:captureState "addr:0x8a0"}true; + assume {:captureState "addr:l00000457"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 32bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 32bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2320bv64), Gamma_R0; @@ -738,19 +738,19 @@ procedure main() call printf(); goto l00000470; l00000470: - assume {:captureState "addr:0x8b0"}true; + assume {:captureState "addr:l00000470"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2232bv64, true; call #free(); goto l0000047f; l0000047f: - assume {:captureState "addr:0x8b8"}true; + assume {:captureState "addr:l0000047f"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R30, Gamma_R30 := 2240bv64, true; call #free(); goto l0000048d; l0000048d: - assume {:captureState "addr:0x8c0"}true; + assume {:captureState "addr:l0000048d"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local2/gcc_O2/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/gcc_O2/malloc_with_local2.expected index 023c5c714..e680279cb 100644 --- a/src/test/correct/malloc_with_local2/gcc_O2/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/gcc_O2/malloc_with_local2.expected @@ -1,47 +1,47 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R2: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2088bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2088bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -153,7 +153,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -162,9 +162,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure __printf_chk(); @@ -624,12 +624,12 @@ procedure main() var #1: bv64; var Gamma_#1: bool; lmain: - assume {:captureState "addr:0x680"}true; + assume {:captureState "addr:lmain"} true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); - assume {:captureState "addr:0x680"}true; + assume {:captureState "%000001f2"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#1, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#1, 8bv64), Gamma_R30); - assume {:captureState "addr:0x680"}true; + assume {:captureState "%000001f8"} true; R31, Gamma_R31 := #1, Gamma_#1; R2, Gamma_R2 := 65bv64, true; R1, Gamma_R1 := 0bv64, true; @@ -640,7 +640,7 @@ procedure main() call __printf_chk(); goto l00000221; l00000221: - assume {:captureState "addr:0x69c"}true; + assume {:captureState "addr:l00000221"} true; R2, Gamma_R2 := 42bv64, true; R1, Gamma_R1 := 0bv64, true; R0, Gamma_R0 := 1bv64, true; @@ -649,7 +649,7 @@ procedure main() call __printf_chk(); goto l0000023d; l0000023d: - assume {:captureState "addr:0x6b0"}true; + assume {:captureState "addr:l0000023d"} true; R2, Gamma_R2 := 10bv64, true; R1, Gamma_R1 := 0bv64, true; R0, Gamma_R0 := 1bv64, true; @@ -658,7 +658,7 @@ procedure main() call __printf_chk(); goto l00000259; l00000259: - assume {:captureState "addr:0x6c4"}true; + assume {:captureState "addr:l00000259"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local2/gcc_no_plt_no_pic/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/gcc_no_plt_no_pic/malloc_with_local2.expected index 8372c230e..6c40463e6 100644 --- a/src/test/correct/malloc_with_local2/gcc_no_plt_no_pic/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/gcc_no_plt_no_pic/malloc_with_local2.expected @@ -1,79 +1,79 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2272bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2272bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,9 +194,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -656,12 +656,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000b0e"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000b14"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -669,46 +669,46 @@ procedure main() call malloc(); goto l00000b2d; l00000b2d: - assume {:captureState "addr:0x824"}true; + assume {:captureState "addr:l00000b2d"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000b33"} true; R0, Gamma_R0 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x82c"}true; + assume {:captureState "%00000b40"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2104bv64, true; call malloc(); goto l00000b4e; l00000b4e: - assume {:captureState "addr:0x838"}true; + assume {:captureState "addr:l00000b4e"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 48bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 48bv64), Gamma_R0); - assume {:captureState "addr:0x838"}true; + assume {:captureState "%00000b54"} true; R0, Gamma_R0 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 32bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); - assume {:captureState "addr:0x840"}true; + assume {:captureState "%00000b61"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000b6f; l00000b6f: - assume {:captureState "addr:0x84c"}true; + assume {:captureState "addr:l00000b6f"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 56bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 56bv64), Gamma_R0); - assume {:captureState "addr:0x84c"}true; + assume {:captureState "%00000b75"} true; R0, Gamma_R0 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 36bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 36bv64), Gamma_R0); - assume {:captureState "addr:0x854"}true; + assume {:captureState "%00000b82"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x860"}true; + assume {:captureState "%00000b96"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x86c"}true; + assume {:captureState "%00000baa"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -719,7 +719,7 @@ procedure main() call printf(); goto l00000bd3; l00000bd3: - assume {:captureState "addr:0x888"}true; + assume {:captureState "addr:l00000bd3"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -730,7 +730,7 @@ procedure main() call printf(); goto l00000bf9; l00000bf9: - assume {:captureState "addr:0x8a0"}true; + assume {:captureState "addr:l00000bf9"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 32bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 32bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2320bv64), Gamma_R0; @@ -738,19 +738,19 @@ procedure main() call printf(); goto l00000c12; l00000c12: - assume {:captureState "addr:0x8b0"}true; + assume {:captureState "addr:l00000c12"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2232bv64, true; call #free(); goto l00000c21; l00000c21: - assume {:captureState "addr:0x8b8"}true; + assume {:captureState "addr:l00000c21"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R30, Gamma_R30 := 2240bv64, true; call #free(); goto l00000c2f; l00000c2f: - assume {:captureState "addr:0x8c0"}true; + assume {:captureState "addr:l00000c2f"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local2/gcc_pic/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/gcc_pic/malloc_with_local2.expected index 8372c230e..6c40463e6 100644 --- a/src/test/correct/malloc_with_local2/gcc_pic/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/gcc_pic/malloc_with_local2.expected @@ -1,79 +1,79 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2272bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2272bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,9 +194,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -656,12 +656,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000b0e"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000b14"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -669,46 +669,46 @@ procedure main() call malloc(); goto l00000b2d; l00000b2d: - assume {:captureState "addr:0x824"}true; + assume {:captureState "addr:l00000b2d"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000b33"} true; R0, Gamma_R0 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x82c"}true; + assume {:captureState "%00000b40"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2104bv64, true; call malloc(); goto l00000b4e; l00000b4e: - assume {:captureState "addr:0x838"}true; + assume {:captureState "addr:l00000b4e"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 48bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 48bv64), Gamma_R0); - assume {:captureState "addr:0x838"}true; + assume {:captureState "%00000b54"} true; R0, Gamma_R0 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 32bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); - assume {:captureState "addr:0x840"}true; + assume {:captureState "%00000b61"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000b6f; l00000b6f: - assume {:captureState "addr:0x84c"}true; + assume {:captureState "addr:l00000b6f"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 56bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 56bv64), Gamma_R0); - assume {:captureState "addr:0x84c"}true; + assume {:captureState "%00000b75"} true; R0, Gamma_R0 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 36bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 36bv64), Gamma_R0); - assume {:captureState "addr:0x854"}true; + assume {:captureState "%00000b82"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x860"}true; + assume {:captureState "%00000b96"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x86c"}true; + assume {:captureState "%00000baa"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -719,7 +719,7 @@ procedure main() call printf(); goto l00000bd3; l00000bd3: - assume {:captureState "addr:0x888"}true; + assume {:captureState "addr:l00000bd3"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -730,7 +730,7 @@ procedure main() call printf(); goto l00000bf9; l00000bf9: - assume {:captureState "addr:0x8a0"}true; + assume {:captureState "addr:l00000bf9"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 32bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 32bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2320bv64), Gamma_R0; @@ -738,19 +738,19 @@ procedure main() call printf(); goto l00000c12; l00000c12: - assume {:captureState "addr:0x8b0"}true; + assume {:captureState "addr:l00000c12"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2232bv64, true; call #free(); goto l00000c21; l00000c21: - assume {:captureState "addr:0x8b8"}true; + assume {:captureState "addr:l00000c21"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R30, Gamma_R30 := 2240bv64, true; call #free(); goto l00000c2f; l00000c2f: - assume {:captureState "addr:0x8c0"}true; + assume {:captureState "addr:l00000c2f"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local3/clang/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/clang/malloc_with_local3.expected index 8e63d24b0..8e69c60a0 100644 --- a/src/test/correct/malloc_with_local3/clang/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/clang/malloc_with_local3.expected @@ -1,84 +1,84 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2344bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2344bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,9 +194,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -638,73 +638,73 @@ procedure main() var Gamma_#4: bool; var Gamma_#7: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%000003ba"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%000003c0"} true; R29, Gamma_R29 := bvadd64(R31, 64bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%000003d3"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); - assume {:captureState "addr:0x828"}true; + assume {:captureState "%000003da"} true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l000003e9; l000003e9: - assume {:captureState "addr:0x834"}true; + assume {:captureState "addr:l000003e9"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R29, 18446744073709551600bv64), R0), gamma_store64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64), Gamma_R0); - assume {:captureState "addr:0x834"}true; + assume {:captureState "%000003ef"} true; R8, Gamma_R8 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551596bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551596bv64), Gamma_R8); - assume {:captureState "addr:0x83c"}true; + assume {:captureState "%000003fc"} true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store64_le(stack, R31, R0), gamma_store64(Gamma_stack, R31, Gamma_R0); - assume {:captureState "addr:0x844"}true; + assume {:captureState "%00000409"} true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000412; l00000412: - assume {:captureState "addr:0x84c"}true; + assume {:captureState "addr:l00000412"} true; R8, Gamma_R8 := R0, Gamma_R0; R0, Gamma_R0 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R8); - assume {:captureState "addr:0x854"}true; + assume {:captureState "%00000425"} true; R8, Gamma_R8 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R8); - assume {:captureState "addr:0x85c"}true; + assume {:captureState "%00000432"} true; R30, Gamma_R30 := 2148bv64, true; call malloc(); goto l0000043b; l0000043b: - assume {:captureState "addr:0x864"}true; + assume {:captureState "addr:l0000043b"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); - assume {:captureState "addr:0x864"}true; + assume {:captureState "%00000441"} true; R8, Gamma_R8 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x86c"}true; + assume {:captureState "%0000044e"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x878"}true; + assume {:captureState "%00000462"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x884"}true; + assume {:captureState "%00000476"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2192bv64, true; call printCharValue(); goto l00000504; l00000504: - assume {:captureState "addr:0x890"}true; + assume {:captureState "addr:l00000504"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -714,7 +714,7 @@ procedure main() call printf(); goto l00000524; l00000524: - assume {:captureState "addr:0x8a4"}true; + assume {:captureState "addr:l00000524"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2364bv64), Gamma_R0; @@ -722,19 +722,19 @@ procedure main() call printf(); goto l0000053d; l0000053d: - assume {:captureState "addr:0x8b4"}true; + assume {:captureState "addr:l0000053d"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2236bv64, true; call #free(); goto l0000054c; l0000054c: - assume {:captureState "addr:0x8bc"}true; + assume {:captureState "addr:l0000054c"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2244bv64, true; call #free(); goto l0000055a; l0000055a: - assume {:captureState "addr:0x8c4"}true; + assume {:captureState "addr:l0000055a"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #7, Gamma_#7 := bvadd64(R31, 64bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #7), gamma_load64(Gamma_stack, #7); @@ -1166,16 +1166,16 @@ procedure printCharValue() var Gamma_#5: bool; var Gamma_#6: bool; lprintCharValue: - assume {:captureState "addr:0x8d4"}true; + assume {:captureState "addr:lprintCharValue"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); - assume {:captureState "addr:0x8d8"}true; + assume {:captureState "%00000496"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#5, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#5, 8bv64), Gamma_R30); - assume {:captureState "addr:0x8d8"}true; + assume {:captureState "%0000049c"} true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x8e0"}true; + assume {:captureState "%000004aa"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R8, Gamma_R8 := zero_extend56_8(memory_load8_le(mem, R9)), (gamma_load8(Gamma_mem, R9) || L(mem, R9)); @@ -1183,7 +1183,7 @@ procedure printCharValue() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x8f0"}true; + assume {:captureState "%000004c6"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -1193,7 +1193,7 @@ procedure printCharValue() call printf(); goto l000004e9; l000004e9: - assume {:captureState "addr:0x908"}true; + assume {:captureState "addr:l000004e9"} true; #6, Gamma_#6 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #6), gamma_load64(Gamma_stack, #6); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(#6, 8bv64)), gamma_load64(Gamma_stack, bvadd64(#6, 8bv64)); diff --git a/src/test/correct/malloc_with_local3/clang_O2/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/clang_O2/malloc_with_local3.expected index abdd2f976..9d9df1295 100644 --- a/src/test/correct/malloc_with_local3/clang_O2/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/clang_O2/malloc_with_local3.expected @@ -1,45 +1,45 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1996bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1996bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -146,7 +146,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -155,9 +155,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -390,12 +390,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%00000318"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%0000031e"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 0bv64, true; @@ -405,7 +405,7 @@ procedure main() call printf(); goto l00000342; l00000342: - assume {:captureState "addr:0x76c"}true; + assume {:captureState "addr:l00000342"} true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2000bv64), Gamma_R0; R1, Gamma_R1 := 42bv64, true; @@ -413,7 +413,7 @@ procedure main() call printf(); goto l00000359; l00000359: - assume {:captureState "addr:0x77c"}true; + assume {:captureState "addr:l00000359"} true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2016bv64), Gamma_R0; R1, Gamma_R1 := 10bv64, true; @@ -421,7 +421,7 @@ procedure main() call printf(); goto l00000370; l00000370: - assume {:captureState "addr:0x78c"}true; + assume {:captureState "addr:l00000370"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local3/clang_no_plt_no_pic/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/clang_no_plt_no_pic/malloc_with_local3.expected index fc27896ba..5aae86cb6 100644 --- a/src/test/correct/malloc_with_local3/clang_no_plt_no_pic/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/clang_no_plt_no_pic/malloc_with_local3.expected @@ -1,84 +1,84 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2344bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2344bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,9 +194,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -638,73 +638,73 @@ procedure main() var Gamma_#4: bool; var Gamma_#7: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000c45"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000c4b"} true; R29, Gamma_R29 := bvadd64(R31, 64bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000c5e"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); - assume {:captureState "addr:0x828"}true; + assume {:captureState "%00000c65"} true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000c74; l00000c74: - assume {:captureState "addr:0x834"}true; + assume {:captureState "addr:l00000c74"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R29, 18446744073709551600bv64), R0), gamma_store64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64), Gamma_R0); - assume {:captureState "addr:0x834"}true; + assume {:captureState "%00000c7a"} true; R8, Gamma_R8 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551596bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551596bv64), Gamma_R8); - assume {:captureState "addr:0x83c"}true; + assume {:captureState "%00000c87"} true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store64_le(stack, R31, R0), gamma_store64(Gamma_stack, R31, Gamma_R0); - assume {:captureState "addr:0x844"}true; + assume {:captureState "%00000c94"} true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000c9d; l00000c9d: - assume {:captureState "addr:0x84c"}true; + assume {:captureState "addr:l00000c9d"} true; R8, Gamma_R8 := R0, Gamma_R0; R0, Gamma_R0 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R8); - assume {:captureState "addr:0x854"}true; + assume {:captureState "%00000cb0"} true; R8, Gamma_R8 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R8); - assume {:captureState "addr:0x85c"}true; + assume {:captureState "%00000cbd"} true; R30, Gamma_R30 := 2148bv64, true; call malloc(); goto l00000cc6; l00000cc6: - assume {:captureState "addr:0x864"}true; + assume {:captureState "addr:l00000cc6"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); - assume {:captureState "addr:0x864"}true; + assume {:captureState "%00000ccc"} true; R8, Gamma_R8 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x86c"}true; + assume {:captureState "%00000cd9"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x878"}true; + assume {:captureState "%00000ced"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x884"}true; + assume {:captureState "%00000d01"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2192bv64, true; call printCharValue(); goto l00000d8f; l00000d8f: - assume {:captureState "addr:0x890"}true; + assume {:captureState "addr:l00000d8f"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -714,7 +714,7 @@ procedure main() call printf(); goto l00000daf; l00000daf: - assume {:captureState "addr:0x8a4"}true; + assume {:captureState "addr:l00000daf"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2364bv64), Gamma_R0; @@ -722,19 +722,19 @@ procedure main() call printf(); goto l00000dc8; l00000dc8: - assume {:captureState "addr:0x8b4"}true; + assume {:captureState "addr:l00000dc8"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2236bv64, true; call #free(); goto l00000dd7; l00000dd7: - assume {:captureState "addr:0x8bc"}true; + assume {:captureState "addr:l00000dd7"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2244bv64, true; call #free(); goto l00000de5; l00000de5: - assume {:captureState "addr:0x8c4"}true; + assume {:captureState "addr:l00000de5"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #7, Gamma_#7 := bvadd64(R31, 64bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #7), gamma_load64(Gamma_stack, #7); @@ -1166,16 +1166,16 @@ procedure printCharValue() var Gamma_#5: bool; var Gamma_#6: bool; lprintCharValue: - assume {:captureState "addr:0x8d4"}true; + assume {:captureState "addr:lprintCharValue"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); - assume {:captureState "addr:0x8d8"}true; + assume {:captureState "%00000d21"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#5, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#5, 8bv64), Gamma_R30); - assume {:captureState "addr:0x8d8"}true; + assume {:captureState "%00000d27"} true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x8e0"}true; + assume {:captureState "%00000d35"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R8, Gamma_R8 := zero_extend56_8(memory_load8_le(mem, R9)), (gamma_load8(Gamma_mem, R9) || L(mem, R9)); @@ -1183,7 +1183,7 @@ procedure printCharValue() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x8f0"}true; + assume {:captureState "%00000d51"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -1193,7 +1193,7 @@ procedure printCharValue() call printf(); goto l00000d74; l00000d74: - assume {:captureState "addr:0x908"}true; + assume {:captureState "addr:l00000d74"} true; #6, Gamma_#6 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #6), gamma_load64(Gamma_stack, #6); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(#6, 8bv64)), gamma_load64(Gamma_stack, bvadd64(#6, 8bv64)); diff --git a/src/test/correct/malloc_with_local3/clang_pic/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/clang_pic/malloc_with_local3.expected index fc27896ba..5aae86cb6 100644 --- a/src/test/correct/malloc_with_local3/clang_pic/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/clang_pic/malloc_with_local3.expected @@ -1,84 +1,84 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2344bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2344bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,9 +194,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -638,73 +638,73 @@ procedure main() var Gamma_#4: bool; var Gamma_#7: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000c45"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000c4b"} true; R29, Gamma_R29 := bvadd64(R31, 64bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000c5e"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); - assume {:captureState "addr:0x828"}true; + assume {:captureState "%00000c65"} true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000c74; l00000c74: - assume {:captureState "addr:0x834"}true; + assume {:captureState "addr:l00000c74"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R29, 18446744073709551600bv64), R0), gamma_store64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64), Gamma_R0); - assume {:captureState "addr:0x834"}true; + assume {:captureState "%00000c7a"} true; R8, Gamma_R8 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551596bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551596bv64), Gamma_R8); - assume {:captureState "addr:0x83c"}true; + assume {:captureState "%00000c87"} true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store64_le(stack, R31, R0), gamma_store64(Gamma_stack, R31, Gamma_R0); - assume {:captureState "addr:0x844"}true; + assume {:captureState "%00000c94"} true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000c9d; l00000c9d: - assume {:captureState "addr:0x84c"}true; + assume {:captureState "addr:l00000c9d"} true; R8, Gamma_R8 := R0, Gamma_R0; R0, Gamma_R0 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R8); - assume {:captureState "addr:0x854"}true; + assume {:captureState "%00000cb0"} true; R8, Gamma_R8 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R8); - assume {:captureState "addr:0x85c"}true; + assume {:captureState "%00000cbd"} true; R30, Gamma_R30 := 2148bv64, true; call malloc(); goto l00000cc6; l00000cc6: - assume {:captureState "addr:0x864"}true; + assume {:captureState "addr:l00000cc6"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); - assume {:captureState "addr:0x864"}true; + assume {:captureState "%00000ccc"} true; R8, Gamma_R8 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x86c"}true; + assume {:captureState "%00000cd9"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x878"}true; + assume {:captureState "%00000ced"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x884"}true; + assume {:captureState "%00000d01"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2192bv64, true; call printCharValue(); goto l00000d8f; l00000d8f: - assume {:captureState "addr:0x890"}true; + assume {:captureState "addr:l00000d8f"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -714,7 +714,7 @@ procedure main() call printf(); goto l00000daf; l00000daf: - assume {:captureState "addr:0x8a4"}true; + assume {:captureState "addr:l00000daf"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2364bv64), Gamma_R0; @@ -722,19 +722,19 @@ procedure main() call printf(); goto l00000dc8; l00000dc8: - assume {:captureState "addr:0x8b4"}true; + assume {:captureState "addr:l00000dc8"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2236bv64, true; call #free(); goto l00000dd7; l00000dd7: - assume {:captureState "addr:0x8bc"}true; + assume {:captureState "addr:l00000dd7"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2244bv64, true; call #free(); goto l00000de5; l00000de5: - assume {:captureState "addr:0x8c4"}true; + assume {:captureState "addr:l00000de5"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #7, Gamma_#7 := bvadd64(R31, 64bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #7), gamma_load64(Gamma_stack, #7); @@ -1166,16 +1166,16 @@ procedure printCharValue() var Gamma_#5: bool; var Gamma_#6: bool; lprintCharValue: - assume {:captureState "addr:0x8d4"}true; + assume {:captureState "addr:lprintCharValue"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); - assume {:captureState "addr:0x8d8"}true; + assume {:captureState "%00000d21"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#5, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#5, 8bv64), Gamma_R30); - assume {:captureState "addr:0x8d8"}true; + assume {:captureState "%00000d27"} true; R29, Gamma_R29 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x8e0"}true; + assume {:captureState "%00000d35"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R8, Gamma_R8 := zero_extend56_8(memory_load8_le(mem, R9)), (gamma_load8(Gamma_mem, R9) || L(mem, R9)); @@ -1183,7 +1183,7 @@ procedure printCharValue() call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x8f0"}true; + assume {:captureState "%00000d51"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -1193,7 +1193,7 @@ procedure printCharValue() call printf(); goto l00000d74; l00000d74: - assume {:captureState "addr:0x908"}true; + assume {:captureState "addr:l00000d74"} true; #6, Gamma_#6 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #6), gamma_load64(Gamma_stack, #6); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(#6, 8bv64)), gamma_load64(Gamma_stack, bvadd64(#6, 8bv64)); diff --git a/src/test/correct/malloc_with_local3/gcc/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/gcc/malloc_with_local3.expected index 10b8ebb3f..d42093c1c 100644 --- a/src/test/correct/malloc_with_local3/gcc/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/gcc/malloc_with_local3.expected @@ -1,80 +1,80 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2328bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2328bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -190,7 +190,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -199,9 +199,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -677,12 +677,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%000003a4"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%000003aa"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -690,52 +690,52 @@ procedure main() call malloc(); goto l000003c3; l000003c3: - assume {:captureState "addr:0x824"}true; + assume {:captureState "addr:l000003c3"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%000003c9"} true; R0, Gamma_R0 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x82c"}true; + assume {:captureState "%000003d6"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2104bv64, true; call malloc(); goto l000003e4; l000003e4: - assume {:captureState "addr:0x838"}true; + assume {:captureState "addr:l000003e4"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 48bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 48bv64), Gamma_R0); - assume {:captureState "addr:0x838"}true; + assume {:captureState "%000003ea"} true; R0, Gamma_R0 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 32bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); - assume {:captureState "addr:0x840"}true; + assume {:captureState "%000003f7"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000405; l00000405: - assume {:captureState "addr:0x84c"}true; + assume {:captureState "addr:l00000405"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 56bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 56bv64), Gamma_R0); - assume {:captureState "addr:0x84c"}true; + assume {:captureState "%0000040b"} true; R0, Gamma_R0 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 36bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 36bv64), Gamma_R0); - assume {:captureState "addr:0x854"}true; + assume {:captureState "%00000418"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x860"}true; + assume {:captureState "%0000042c"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x86c"}true; + assume {:captureState "%00000440"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2168bv64, true; call printCharValue(); goto l000004db; l000004db: - assume {:captureState "addr:0x878"}true; + assume {:captureState "addr:l000004db"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -746,7 +746,7 @@ procedure main() call printf(); goto l00000501; l00000501: - assume {:captureState "addr:0x890"}true; + assume {:captureState "addr:l00000501"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 32bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 32bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2352bv64), Gamma_R0; @@ -754,19 +754,19 @@ procedure main() call printf(); goto l0000051a; l0000051a: - assume {:captureState "addr:0x8a0"}true; + assume {:captureState "addr:l0000051a"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2216bv64, true; call #free(); goto l00000529; l00000529: - assume {:captureState "addr:0x8a8"}true; + assume {:captureState "addr:l00000529"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R30, Gamma_R30 := 2224bv64, true; call #free(); goto l00000537; l00000537: - assume {:captureState "addr:0x8b0"}true; + assume {:captureState "addr:l00000537"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -1231,16 +1231,16 @@ procedure printCharValue() var #5: bv64; var Gamma_#5: bool; lprintCharValue: - assume {:captureState "addr:0x8bc"}true; + assume {:captureState "addr:lprintCharValue"} true; #5, Gamma_#5 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); - assume {:captureState "addr:0x8bc"}true; + assume {:captureState "%0000045a"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#5, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#5, 8bv64), Gamma_R30); - assume {:captureState "addr:0x8bc"}true; + assume {:captureState "%00000460"} true; R31, Gamma_R31 := #5, Gamma_#5; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x8c4"}true; + assume {:captureState "%00000472"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -1250,7 +1250,7 @@ procedure printCharValue() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x8dc"}true; + assume {:captureState "%0000049b"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -1261,7 +1261,7 @@ procedure printCharValue() call printf(); goto l000004c4; l000004c4: - assume {:captureState "addr:0x8f8"}true; + assume {:captureState "addr:l000004c4"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; diff --git a/src/test/correct/malloc_with_local3/gcc_O2/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/gcc_O2/malloc_with_local3.expected index b2fd5b9eb..b7dd816ae 100644 --- a/src/test/correct/malloc_with_local3/gcc_O2/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/gcc_O2/malloc_with_local3.expected @@ -1,70 +1,70 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R19: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R3: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R19: bv64; -var {:extern }R2: bv64; -var {:extern }R29: bv64; -var {:extern }R3: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2264bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R19: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R3: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R19: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R3: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2264bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -176,7 +176,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,9 +185,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure __printf_chk(); @@ -866,33 +866,33 @@ procedure main() var #1: bv64; var Gamma_#1: bool; lmain: - assume {:captureState "addr:0x700"}true; + assume {:captureState "addr:lmain"} true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); - assume {:captureState "addr:0x700"}true; + assume {:captureState "%00000222"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#1, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#1, 8bv64), Gamma_R30); - assume {:captureState "addr:0x700"}true; + assume {:captureState "%00000228"} true; R31, Gamma_R31 := #1, Gamma_#1; R0, Gamma_R0 := 1bv64, true; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R19), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R19); - assume {:captureState "addr:0x70c"}true; + assume {:captureState "%0000023f"} true; R30, Gamma_R30 := 1812bv64, true; call malloc(); goto l00000249; l00000249: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:l00000249"} true; R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000254"} true; R19, Gamma_R19 := R0, Gamma_R0; R30, Gamma_R30 := 1828bv64, true; call printCharValue(); goto l0000029a; l0000029a: - assume {:captureState "addr:0x724"}true; + assume {:captureState "addr:l0000029a"} true; R2, Gamma_R2 := 42bv64, true; R1, Gamma_R1 := 0bv64, true; R0, Gamma_R0 := 1bv64, true; @@ -901,7 +901,7 @@ procedure main() call __printf_chk(); goto l000002b6; l000002b6: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l000002b6"} true; R1, Gamma_R1 := 0bv64, true; R1, Gamma_R1 := bvadd64(R1, 2312bv64), Gamma_R1; R2, Gamma_R2 := 10bv64, true; @@ -910,13 +910,13 @@ procedure main() call __printf_chk(); goto l000002d2; l000002d2: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:l000002d2"} true; R0, Gamma_R0 := R19, Gamma_R19; R30, Gamma_R30 := 1876bv64, true; call #free(); goto l000002e0; l000002e0: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:l000002e0"} true; R0, Gamma_R0 := 0bv64, true; R19, Gamma_R19 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); @@ -1360,7 +1360,7 @@ procedure printCharValue() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lprintCharValue: - assume {:captureState "addr:0x8a0"}true; + assume {:captureState "addr:lprintCharValue"} true; R3, Gamma_R3 := R0, Gamma_R0; R0, Gamma_R0 := 1bv64, true; R1, Gamma_R1 := 0bv64, true; @@ -1372,7 +1372,7 @@ procedure printCharValue() call rely(); assert (L(mem, R3) ==> Gamma_R2); mem, Gamma_mem := memory_store8_le(mem, R3, R2[8:0]), gamma_store8(Gamma_mem, R3, Gamma_R2); - assume {:captureState "addr:0x8bc"}true; + assume {:captureState "%00000293"} true; call __printf_chk(); //no return target assume false; diff --git a/src/test/correct/malloc_with_local3/gcc_no_plt_no_pic/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/gcc_no_plt_no_pic/malloc_with_local3.expected index deef3778f..d1c04e08d 100644 --- a/src/test/correct/malloc_with_local3/gcc_no_plt_no_pic/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/gcc_no_plt_no_pic/malloc_with_local3.expected @@ -1,80 +1,80 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2328bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2328bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -190,7 +190,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -199,9 +199,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -677,12 +677,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000c00"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000c06"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -690,52 +690,52 @@ procedure main() call malloc(); goto l00000c1f; l00000c1f: - assume {:captureState "addr:0x824"}true; + assume {:captureState "addr:l00000c1f"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000c25"} true; R0, Gamma_R0 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x82c"}true; + assume {:captureState "%00000c32"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2104bv64, true; call malloc(); goto l00000c40; l00000c40: - assume {:captureState "addr:0x838"}true; + assume {:captureState "addr:l00000c40"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 48bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 48bv64), Gamma_R0); - assume {:captureState "addr:0x838"}true; + assume {:captureState "%00000c46"} true; R0, Gamma_R0 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 32bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); - assume {:captureState "addr:0x840"}true; + assume {:captureState "%00000c53"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000c61; l00000c61: - assume {:captureState "addr:0x84c"}true; + assume {:captureState "addr:l00000c61"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 56bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 56bv64), Gamma_R0); - assume {:captureState "addr:0x84c"}true; + assume {:captureState "%00000c67"} true; R0, Gamma_R0 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 36bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 36bv64), Gamma_R0); - assume {:captureState "addr:0x854"}true; + assume {:captureState "%00000c74"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x860"}true; + assume {:captureState "%00000c88"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x86c"}true; + assume {:captureState "%00000c9c"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2168bv64, true; call printCharValue(); goto l00000d37; l00000d37: - assume {:captureState "addr:0x878"}true; + assume {:captureState "addr:l00000d37"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -746,7 +746,7 @@ procedure main() call printf(); goto l00000d5d; l00000d5d: - assume {:captureState "addr:0x890"}true; + assume {:captureState "addr:l00000d5d"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 32bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 32bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2352bv64), Gamma_R0; @@ -754,19 +754,19 @@ procedure main() call printf(); goto l00000d76; l00000d76: - assume {:captureState "addr:0x8a0"}true; + assume {:captureState "addr:l00000d76"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2216bv64, true; call #free(); goto l00000d85; l00000d85: - assume {:captureState "addr:0x8a8"}true; + assume {:captureState "addr:l00000d85"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R30, Gamma_R30 := 2224bv64, true; call #free(); goto l00000d93; l00000d93: - assume {:captureState "addr:0x8b0"}true; + assume {:captureState "addr:l00000d93"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -1231,16 +1231,16 @@ procedure printCharValue() var #5: bv64; var Gamma_#5: bool; lprintCharValue: - assume {:captureState "addr:0x8bc"}true; + assume {:captureState "addr:lprintCharValue"} true; #5, Gamma_#5 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); - assume {:captureState "addr:0x8bc"}true; + assume {:captureState "%00000cb6"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#5, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#5, 8bv64), Gamma_R30); - assume {:captureState "addr:0x8bc"}true; + assume {:captureState "%00000cbc"} true; R31, Gamma_R31 := #5, Gamma_#5; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x8c4"}true; + assume {:captureState "%00000cce"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -1250,7 +1250,7 @@ procedure printCharValue() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x8dc"}true; + assume {:captureState "%00000cf7"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -1261,7 +1261,7 @@ procedure printCharValue() call printf(); goto l00000d20; l00000d20: - assume {:captureState "addr:0x8f8"}true; + assume {:captureState "addr:l00000d20"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; diff --git a/src/test/correct/malloc_with_local3/gcc_pic/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/gcc_pic/malloc_with_local3.expected index deef3778f..d1c04e08d 100644 --- a/src/test/correct/malloc_with_local3/gcc_pic/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/gcc_pic/malloc_with_local3.expected @@ -1,80 +1,80 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2328bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2328bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -190,7 +190,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -199,9 +199,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -677,12 +677,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000c00"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000c06"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -690,52 +690,52 @@ procedure main() call malloc(); goto l00000c1f; l00000c1f: - assume {:captureState "addr:0x824"}true; + assume {:captureState "addr:l00000c1f"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000c25"} true; R0, Gamma_R0 := 11bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x82c"}true; + assume {:captureState "%00000c32"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2104bv64, true; call malloc(); goto l00000c40; l00000c40: - assume {:captureState "addr:0x838"}true; + assume {:captureState "addr:l00000c40"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 48bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 48bv64), Gamma_R0); - assume {:captureState "addr:0x838"}true; + assume {:captureState "%00000c46"} true; R0, Gamma_R0 := 10bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 32bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); - assume {:captureState "addr:0x840"}true; + assume {:captureState "%00000c53"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2124bv64, true; call malloc(); goto l00000c61; l00000c61: - assume {:captureState "addr:0x84c"}true; + assume {:captureState "addr:l00000c61"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 56bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 56bv64), Gamma_R0); - assume {:captureState "addr:0x84c"}true; + assume {:captureState "%00000c67"} true; R0, Gamma_R0 := 9bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 36bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 36bv64), Gamma_R0); - assume {:captureState "addr:0x854"}true; + assume {:captureState "%00000c74"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x860"}true; + assume {:captureState "%00000c88"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x86c"}true; + assume {:captureState "%00000c9c"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2168bv64, true; call printCharValue(); goto l00000d37; l00000d37: - assume {:captureState "addr:0x878"}true; + assume {:captureState "addr:l00000d37"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -746,7 +746,7 @@ procedure main() call printf(); goto l00000d5d; l00000d5d: - assume {:captureState "addr:0x890"}true; + assume {:captureState "addr:l00000d5d"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 32bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 32bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2352bv64), Gamma_R0; @@ -754,19 +754,19 @@ procedure main() call printf(); goto l00000d76; l00000d76: - assume {:captureState "addr:0x8a0"}true; + assume {:captureState "addr:l00000d76"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2216bv64, true; call #free(); goto l00000d85; l00000d85: - assume {:captureState "addr:0x8a8"}true; + assume {:captureState "addr:l00000d85"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R30, Gamma_R30 := 2224bv64, true; call #free(); goto l00000d93; l00000d93: - assume {:captureState "addr:0x8b0"}true; + assume {:captureState "addr:l00000d93"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -1231,16 +1231,16 @@ procedure printCharValue() var #5: bv64; var Gamma_#5: bool; lprintCharValue: - assume {:captureState "addr:0x8bc"}true; + assume {:captureState "addr:lprintCharValue"} true; #5, Gamma_#5 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); - assume {:captureState "addr:0x8bc"}true; + assume {:captureState "%00000cb6"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#5, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#5, 8bv64), Gamma_R30); - assume {:captureState "addr:0x8bc"}true; + assume {:captureState "%00000cbc"} true; R31, Gamma_R31 := #5, Gamma_#5; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x8c4"}true; + assume {:captureState "%00000cce"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -1250,7 +1250,7 @@ procedure printCharValue() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x8dc"}true; + assume {:captureState "%00000cf7"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -1261,7 +1261,7 @@ procedure printCharValue() call printf(); goto l00000d20; l00000d20: - assume {:captureState "addr:0x8f8"}true; + assume {:captureState "addr:l00000d20"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; diff --git a/src/test/correct/multi_malloc/clang/multi_malloc.expected b/src/test/correct/multi_malloc/clang/multi_malloc.expected index 957754193..bfc6dccdd 100644 --- a/src/test/correct/multi_malloc/clang/multi_malloc.expected +++ b/src/test/correct/multi_malloc/clang/multi_malloc.expected @@ -1,83 +1,83 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2232bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2232bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -151,7 +151,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -160,9 +160,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -472,47 +472,47 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%0000034a"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000350"} true; R29, Gamma_R29 := bvadd64(R31, 32bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000363"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); - assume {:captureState "addr:0x828"}true; + assume {:captureState "%0000036a"} true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000379; l00000379: - assume {:captureState "addr:0x834"}true; + assume {:captureState "addr:l00000379"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); - assume {:captureState "addr:0x834"}true; + assume {:captureState "%0000037f"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2112bv64, true; call malloc(); goto l0000038d; l0000038d: - assume {:captureState "addr:0x840"}true; + assume {:captureState "addr:l0000038d"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x840"}true; + assume {:captureState "%00000393"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x84c"}true; + assume {:captureState "%000003a7"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x858"}true; + assume {:captureState "%000003bb"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -522,7 +522,7 @@ procedure main() call printf(); goto l000003de; l000003de: - assume {:captureState "addr:0x870"}true; + assume {:captureState "addr:l000003de"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -532,19 +532,19 @@ procedure main() call printf(); goto l000003fe; l000003fe: - assume {:captureState "addr:0x884"}true; + assume {:captureState "addr:l000003fe"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2188bv64, true; call #free(); goto l0000040d; l0000040d: - assume {:captureState "addr:0x88c"}true; + assume {:captureState "addr:l0000040d"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2196bv64, true; call #free(); goto l0000041b; l0000041b: - assume {:captureState "addr:0x894"}true; + assume {:captureState "addr:l0000041b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/multi_malloc/clang_O2/multi_malloc.expected b/src/test/correct/multi_malloc/clang_O2/multi_malloc.expected index 983f2bee1..6837f9a9c 100644 --- a/src/test/correct/multi_malloc/clang_O2/multi_malloc.expected +++ b/src/test/correct/multi_malloc/clang_O2/multi_malloc.expected @@ -1,45 +1,45 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1948bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1948bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -113,7 +113,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -122,9 +122,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -291,12 +291,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000002e8"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000002ee"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 0bv64, true; @@ -306,7 +306,7 @@ procedure main() call printf(); goto l00000312; l00000312: - assume {:captureState "addr:0x76c"}true; + assume {:captureState "addr:l00000312"} true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 1969bv64), Gamma_R0; R1, Gamma_R1 := 42bv64, true; @@ -314,7 +314,7 @@ procedure main() call printf(); goto l00000329; l00000329: - assume {:captureState "addr:0x77c"}true; + assume {:captureState "addr:l00000329"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/multi_malloc/clang_no_plt_no_pic/multi_malloc.expected b/src/test/correct/multi_malloc/clang_no_plt_no_pic/multi_malloc.expected index 86eef3bee..0bd9b5530 100644 --- a/src/test/correct/multi_malloc/clang_no_plt_no_pic/multi_malloc.expected +++ b/src/test/correct/multi_malloc/clang_no_plt_no_pic/multi_malloc.expected @@ -1,83 +1,83 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2232bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2232bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -151,7 +151,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -160,9 +160,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -472,47 +472,47 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000a78"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000a7e"} true; R29, Gamma_R29 := bvadd64(R31, 32bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000a91"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); - assume {:captureState "addr:0x828"}true; + assume {:captureState "%00000a98"} true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000aa7; l00000aa7: - assume {:captureState "addr:0x834"}true; + assume {:captureState "addr:l00000aa7"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); - assume {:captureState "addr:0x834"}true; + assume {:captureState "%00000aad"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2112bv64, true; call malloc(); goto l00000abb; l00000abb: - assume {:captureState "addr:0x840"}true; + assume {:captureState "addr:l00000abb"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x840"}true; + assume {:captureState "%00000ac1"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x84c"}true; + assume {:captureState "%00000ad5"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x858"}true; + assume {:captureState "%00000ae9"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -522,7 +522,7 @@ procedure main() call printf(); goto l00000b0c; l00000b0c: - assume {:captureState "addr:0x870"}true; + assume {:captureState "addr:l00000b0c"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -532,19 +532,19 @@ procedure main() call printf(); goto l00000b2c; l00000b2c: - assume {:captureState "addr:0x884"}true; + assume {:captureState "addr:l00000b2c"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2188bv64, true; call #free(); goto l00000b3b; l00000b3b: - assume {:captureState "addr:0x88c"}true; + assume {:captureState "addr:l00000b3b"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2196bv64, true; call #free(); goto l00000b49; l00000b49: - assume {:captureState "addr:0x894"}true; + assume {:captureState "addr:l00000b49"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/multi_malloc/clang_pic/multi_malloc.expected b/src/test/correct/multi_malloc/clang_pic/multi_malloc.expected index 86eef3bee..0bd9b5530 100644 --- a/src/test/correct/multi_malloc/clang_pic/multi_malloc.expected +++ b/src/test/correct/multi_malloc/clang_pic/multi_malloc.expected @@ -1,83 +1,83 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2232bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2232bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -151,7 +151,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -160,9 +160,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -472,47 +472,47 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000a78"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x818"}true; + assume {:captureState "%00000a7e"} true; R29, Gamma_R29 := bvadd64(R31, 32bv64), Gamma_R31; R8, Gamma_R8 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000a91"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); - assume {:captureState "addr:0x828"}true; + assume {:captureState "%00000a98"} true; R0, Gamma_R0 := 1bv64, true; R30, Gamma_R30 := 2100bv64, true; call malloc(); goto l00000aa7; l00000aa7: - assume {:captureState "addr:0x834"}true; + assume {:captureState "addr:l00000aa7"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); - assume {:captureState "addr:0x834"}true; + assume {:captureState "%00000aad"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2112bv64, true; call malloc(); goto l00000abb; l00000abb: - assume {:captureState "addr:0x840"}true; + assume {:captureState "addr:l00000abb"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x840"}true; + assume {:captureState "%00000ac1"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R8, Gamma_R8 := 65bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x84c"}true; + assume {:captureState "%00000ad5"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 42bv64, true; call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x858"}true; + assume {:captureState "%00000ae9"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); call rely(); R1, Gamma_R1 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); @@ -522,7 +522,7 @@ procedure main() call printf(); goto l00000b0c; l00000b0c: - assume {:captureState "addr:0x870"}true; + assume {:captureState "addr:l00000b0c"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -532,19 +532,19 @@ procedure main() call printf(); goto l00000b2c; l00000b2c: - assume {:captureState "addr:0x884"}true; + assume {:captureState "addr:l00000b2c"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2188bv64, true; call #free(); goto l00000b3b; l00000b3b: - assume {:captureState "addr:0x88c"}true; + assume {:captureState "addr:l00000b3b"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2196bv64, true; call #free(); goto l00000b49; l00000b49: - assume {:captureState "addr:0x894"}true; + assume {:captureState "addr:l00000b49"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/multi_malloc/gcc/multi_malloc.expected b/src/test/correct/multi_malloc/gcc/multi_malloc.expected index 9897cd900..8d5d8855b 100644 --- a/src/test/correct/multi_malloc/gcc/multi_malloc.expected +++ b/src/test/correct/multi_malloc/gcc/multi_malloc.expected @@ -1,79 +1,79 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2224bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2224bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -158,7 +158,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -167,9 +167,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -521,12 +521,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000338"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%0000033e"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -534,29 +534,29 @@ procedure main() call malloc(); goto l00000357; l00000357: - assume {:captureState "addr:0x824"}true; + assume {:captureState "addr:l00000357"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%0000035d"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2096bv64, true; call malloc(); goto l0000036b; l0000036b: - assume {:captureState "addr:0x830"}true; + assume {:captureState "addr:l0000036b"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x830"}true; + assume {:captureState "%00000371"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x83c"}true; + assume {:captureState "%00000385"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x848"}true; + assume {:captureState "%00000399"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -567,7 +567,7 @@ procedure main() call printf(); goto l000003c2; l000003c2: - assume {:captureState "addr:0x864"}true; + assume {:captureState "addr:l000003c2"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -578,19 +578,19 @@ procedure main() call printf(); goto l000003e8; l000003e8: - assume {:captureState "addr:0x87c"}true; + assume {:captureState "addr:l000003e8"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2180bv64, true; call #free(); goto l000003f7; l000003f7: - assume {:captureState "addr:0x884"}true; + assume {:captureState "addr:l000003f7"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 2188bv64, true; call #free(); goto l00000405; l00000405: - assume {:captureState "addr:0x88c"}true; + assume {:captureState "addr:l00000405"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/multi_malloc/gcc_O2/multi_malloc.expected b/src/test/correct/multi_malloc/gcc_O2/multi_malloc.expected index b456c480d..f780a9e26 100644 --- a/src/test/correct/multi_malloc/gcc_O2/multi_malloc.expected +++ b/src/test/correct/multi_malloc/gcc_O2/multi_malloc.expected @@ -1,47 +1,47 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R2: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2024bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R2: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2024bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -126,7 +126,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -135,9 +135,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure __printf_chk(); @@ -489,12 +489,12 @@ procedure main() var #1: bv64; var Gamma_#1: bool; lmain: - assume {:captureState "addr:0x680"}true; + assume {:captureState "addr:lmain"} true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); - assume {:captureState "addr:0x680"}true; + assume {:captureState "%000001b2"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#1, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#1, 8bv64), Gamma_R30); - assume {:captureState "addr:0x680"}true; + assume {:captureState "%000001b8"} true; R31, Gamma_R31 := #1, Gamma_#1; R2, Gamma_R2 := 65bv64, true; R1, Gamma_R1 := 0bv64, true; @@ -505,7 +505,7 @@ procedure main() call __printf_chk(); goto l000001e1; l000001e1: - assume {:captureState "addr:0x69c"}true; + assume {:captureState "addr:l000001e1"} true; R2, Gamma_R2 := 42bv64, true; R1, Gamma_R1 := 0bv64, true; R0, Gamma_R0 := 1bv64, true; @@ -514,7 +514,7 @@ procedure main() call __printf_chk(); goto l000001fd; l000001fd: - assume {:captureState "addr:0x6b0"}true; + assume {:captureState "addr:l000001fd"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/multi_malloc/gcc_no_plt_no_pic/multi_malloc.expected b/src/test/correct/multi_malloc/gcc_no_plt_no_pic/multi_malloc.expected index 7c5417b45..2590a4df1 100644 --- a/src/test/correct/multi_malloc/gcc_no_plt_no_pic/multi_malloc.expected +++ b/src/test/correct/multi_malloc/gcc_no_plt_no_pic/multi_malloc.expected @@ -1,79 +1,79 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2224bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2224bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -158,7 +158,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -167,9 +167,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -521,12 +521,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000a45"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000a4b"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -534,29 +534,29 @@ procedure main() call malloc(); goto l00000a64; l00000a64: - assume {:captureState "addr:0x824"}true; + assume {:captureState "addr:l00000a64"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000a6a"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2096bv64, true; call malloc(); goto l00000a78; l00000a78: - assume {:captureState "addr:0x830"}true; + assume {:captureState "addr:l00000a78"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x830"}true; + assume {:captureState "%00000a7e"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x83c"}true; + assume {:captureState "%00000a92"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x848"}true; + assume {:captureState "%00000aa6"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -567,7 +567,7 @@ procedure main() call printf(); goto l00000acf; l00000acf: - assume {:captureState "addr:0x864"}true; + assume {:captureState "addr:l00000acf"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -578,19 +578,19 @@ procedure main() call printf(); goto l00000af5; l00000af5: - assume {:captureState "addr:0x87c"}true; + assume {:captureState "addr:l00000af5"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2180bv64, true; call #free(); goto l00000b04; l00000b04: - assume {:captureState "addr:0x884"}true; + assume {:captureState "addr:l00000b04"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 2188bv64, true; call #free(); goto l00000b12; l00000b12: - assume {:captureState "addr:0x88c"}true; + assume {:captureState "addr:l00000b12"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/multi_malloc/gcc_pic/multi_malloc.expected b/src/test/correct/multi_malloc/gcc_pic/multi_malloc.expected index 7c5417b45..2590a4df1 100644 --- a/src/test/correct/multi_malloc/gcc_pic/multi_malloc.expected +++ b/src/test/correct/multi_malloc/gcc_pic/multi_malloc.expected @@ -1,79 +1,79 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 2224bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 2224bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -158,7 +158,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -167,9 +167,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -521,12 +521,12 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x814"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000a45"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x814"}true; + assume {:captureState "%00000a4b"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; R0, Gamma_R0 := 1bv64, true; @@ -534,29 +534,29 @@ procedure main() call malloc(); goto l00000a64; l00000a64: - assume {:captureState "addr:0x824"}true; + assume {:captureState "addr:l00000a64"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); - assume {:captureState "addr:0x824"}true; + assume {:captureState "%00000a6a"} true; R0, Gamma_R0 := 4bv64, true; R30, Gamma_R30 := 2096bv64, true; call malloc(); goto l00000a78; l00000a78: - assume {:captureState "addr:0x830"}true; + assume {:captureState "addr:l00000a78"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x830"}true; + assume {:captureState "%00000a7e"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x83c"}true; + assume {:captureState "%00000a92"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R1, Gamma_R1 := 42bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x848"}true; + assume {:captureState "%00000aa6"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); @@ -567,7 +567,7 @@ procedure main() call printf(); goto l00000acf; l00000acf: - assume {:captureState "addr:0x864"}true; + assume {:captureState "addr:l00000acf"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -578,19 +578,19 @@ procedure main() call printf(); goto l00000af5; l00000af5: - assume {:captureState "addr:0x87c"}true; + assume {:captureState "addr:l00000af5"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2180bv64, true; call #free(); goto l00000b04; l00000b04: - assume {:captureState "addr:0x884"}true; + assume {:captureState "addr:l00000b04"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 2188bv64, true; call #free(); goto l00000b12; l00000b12: - assume {:captureState "addr:0x88c"}true; + assume {:captureState "addr:l00000b12"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/nestedif/clang/nestedif.expected b/src/test/correct/nestedif/clang/nestedif.expected index 5abf39619..2087b50c5 100644 --- a/src/test/correct/nestedif/clang/nestedif.expected +++ b/src/test/correct/nestedif/clang/nestedif.expected @@ -1,46 +1,46 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1968bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1968bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -203,15 +203,15 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%0000033d"} true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%0000034a"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), true); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000351"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 0bv33))), (Gamma_R8 && Gamma_#4); @@ -237,7 +237,7 @@ procedure main() } goto l00000442; l00000387: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000387"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R8[32:0], 4294967294bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934591bv33))), (Gamma_R8 && Gamma_#5); @@ -263,7 +263,7 @@ procedure main() } goto l0000042d; l000003c0: - assume {:captureState "addr:0x768"}true; + assume {:captureState "addr:l000003c0"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #6, Gamma_#6 := bvadd32(R8[32:0], 4294967293bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934590bv33))), (Gamma_R8 && Gamma_#6); @@ -289,40 +289,40 @@ procedure main() } goto l00000418; l00000418: - assume {:captureState "addr:0x778"}true; + assume {:captureState "addr:l00000418"} true; goto l00000419; l00000419: - assume {:captureState "addr:0x77c"}true; + assume {:captureState "addr:l00000419"} true; R8, Gamma_R8 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x780"}true; + assume {:captureState "%00000427"} true; goto l000003f9; l000003f9: - assume {:captureState "addr:0x788"}true; + assume {:captureState "addr:l000003f9"} true; goto l000003ff; l0000042d: - assume {:captureState "addr:0x758"}true; + assume {:captureState "addr:l0000042d"} true; goto l0000042e; l0000042e: - assume {:captureState "addr:0x75c"}true; + assume {:captureState "addr:l0000042e"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%0000043c"} true; goto l000003ff; l000003ff: - assume {:captureState "addr:0x78c"}true; + assume {:captureState "addr:l000003ff"} true; goto l00000403; l00000442: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l00000442"} true; goto l00000443; l00000443: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000443"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000451"} true; goto l00000403; l00000403: - assume {:captureState "addr:0x790"}true; + assume {:captureState "addr:l00000403"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/nestedif/clang_O2/nestedif.expected b/src/test/correct/nestedif/clang_O2/nestedif.expected index 863d7bd46..dfc8a4e7d 100644 --- a/src/test/correct/nestedif/clang_O2/nestedif.expected +++ b/src/test/correct/nestedif/clang_O2/nestedif.expected @@ -1,14 +1,14 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1840bv64); -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1840bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/nestedif/clang_no_plt_no_pic/nestedif.expected b/src/test/correct/nestedif/clang_no_plt_no_pic/nestedif.expected index a11142224..b85515bb7 100644 --- a/src/test/correct/nestedif/clang_no_plt_no_pic/nestedif.expected +++ b/src/test/correct/nestedif/clang_no_plt_no_pic/nestedif.expected @@ -1,46 +1,46 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1968bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1968bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -203,15 +203,15 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000a6e"} true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000a7b"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), true); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000a82"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 0bv33))), (Gamma_R8 && Gamma_#4); @@ -237,7 +237,7 @@ procedure main() } goto l00000b73; l00000ab8: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000ab8"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R8[32:0], 4294967294bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934591bv33))), (Gamma_R8 && Gamma_#5); @@ -263,7 +263,7 @@ procedure main() } goto l00000b5e; l00000af1: - assume {:captureState "addr:0x768"}true; + assume {:captureState "addr:l00000af1"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #6, Gamma_#6 := bvadd32(R8[32:0], 4294967293bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934590bv33))), (Gamma_R8 && Gamma_#6); @@ -289,40 +289,40 @@ procedure main() } goto l00000b49; l00000b49: - assume {:captureState "addr:0x778"}true; + assume {:captureState "addr:l00000b49"} true; goto l00000b4a; l00000b4a: - assume {:captureState "addr:0x77c"}true; + assume {:captureState "addr:l00000b4a"} true; R8, Gamma_R8 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x780"}true; + assume {:captureState "%00000b58"} true; goto l00000b2a; l00000b2a: - assume {:captureState "addr:0x788"}true; + assume {:captureState "addr:l00000b2a"} true; goto l00000b30; l00000b5e: - assume {:captureState "addr:0x758"}true; + assume {:captureState "addr:l00000b5e"} true; goto l00000b5f; l00000b5f: - assume {:captureState "addr:0x75c"}true; + assume {:captureState "addr:l00000b5f"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%00000b6d"} true; goto l00000b30; l00000b30: - assume {:captureState "addr:0x78c"}true; + assume {:captureState "addr:l00000b30"} true; goto l00000b34; l00000b73: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l00000b73"} true; goto l00000b74; l00000b74: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000b74"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000b82"} true; goto l00000b34; l00000b34: - assume {:captureState "addr:0x790"}true; + assume {:captureState "addr:l00000b34"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/nestedif/clang_pic/nestedif.expected b/src/test/correct/nestedif/clang_pic/nestedif.expected index a11142224..b85515bb7 100644 --- a/src/test/correct/nestedif/clang_pic/nestedif.expected +++ b/src/test/correct/nestedif/clang_pic/nestedif.expected @@ -1,46 +1,46 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1968bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1968bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -203,15 +203,15 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000a6e"} true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000a7b"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), true); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000a82"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 0bv33))), (Gamma_R8 && Gamma_#4); @@ -237,7 +237,7 @@ procedure main() } goto l00000b73; l00000ab8: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000ab8"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R8[32:0], 4294967294bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934591bv33))), (Gamma_R8 && Gamma_#5); @@ -263,7 +263,7 @@ procedure main() } goto l00000b5e; l00000af1: - assume {:captureState "addr:0x768"}true; + assume {:captureState "addr:l00000af1"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #6, Gamma_#6 := bvadd32(R8[32:0], 4294967293bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934590bv33))), (Gamma_R8 && Gamma_#6); @@ -289,40 +289,40 @@ procedure main() } goto l00000b49; l00000b49: - assume {:captureState "addr:0x778"}true; + assume {:captureState "addr:l00000b49"} true; goto l00000b4a; l00000b4a: - assume {:captureState "addr:0x77c"}true; + assume {:captureState "addr:l00000b4a"} true; R8, Gamma_R8 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x780"}true; + assume {:captureState "%00000b58"} true; goto l00000b2a; l00000b2a: - assume {:captureState "addr:0x788"}true; + assume {:captureState "addr:l00000b2a"} true; goto l00000b30; l00000b5e: - assume {:captureState "addr:0x758"}true; + assume {:captureState "addr:l00000b5e"} true; goto l00000b5f; l00000b5f: - assume {:captureState "addr:0x75c"}true; + assume {:captureState "addr:l00000b5f"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%00000b6d"} true; goto l00000b30; l00000b30: - assume {:captureState "addr:0x78c"}true; + assume {:captureState "addr:l00000b30"} true; goto l00000b34; l00000b73: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l00000b73"} true; goto l00000b74; l00000b74: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000b74"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000b82"} true; goto l00000b34; l00000b34: - assume {:captureState "addr:0x790"}true; + assume {:captureState "addr:l00000b34"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/nestedif/gcc/nestedif.expected b/src/test/correct/nestedif/gcc/nestedif.expected index e9ee57ce5..ac520a132 100644 --- a/src/test/correct/nestedif/gcc/nestedif.expected +++ b/src/test/correct/nestedif/gcc/nestedif.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1928bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1928bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -201,13 +201,13 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%0000031b"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000322"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -220,7 +220,7 @@ procedure main() } goto l000003c4; l00000345: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000345"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#5); @@ -233,7 +233,7 @@ procedure main() } goto l000003b3; l0000036b: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:l0000036b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#6); @@ -246,25 +246,25 @@ procedure main() } goto l000003a6; l000003a6: - assume {:captureState "addr:0x760"}true; + assume {:captureState "addr:l000003a6"} true; R0, Gamma_R0 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%000003b1"} true; goto l00000391; l000003b3: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l000003b3"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x74c"}true; + assume {:captureState "%000003be"} true; goto l00000391; l000003c4: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l000003c4"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%000003cf"} true; goto l00000391; l00000391: - assume {:captureState "addr:0x768"}true; + assume {:captureState "addr:l00000391"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/nestedif/gcc_O2/nestedif.expected b/src/test/correct/nestedif/gcc_O2/nestedif.expected index 418f9a5da..db578d839 100644 --- a/src/test/correct/nestedif/gcc_O2/nestedif.expected +++ b/src/test/correct/nestedif/gcc_O2/nestedif.expected @@ -1,14 +1,14 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1896bv64); -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1896bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/nestedif/gcc_no_plt_no_pic/nestedif.expected b/src/test/correct/nestedif/gcc_no_plt_no_pic/nestedif.expected index 0980d9726..d94363d97 100644 --- a/src/test/correct/nestedif/gcc_no_plt_no_pic/nestedif.expected +++ b/src/test/correct/nestedif/gcc_no_plt_no_pic/nestedif.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1928bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1928bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -201,13 +201,13 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000009b7"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000009be"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -220,7 +220,7 @@ procedure main() } goto l00000a60; l000009e1: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l000009e1"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#5); @@ -233,7 +233,7 @@ procedure main() } goto l00000a4f; l00000a07: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:l00000a07"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#6); @@ -246,25 +246,25 @@ procedure main() } goto l00000a42; l00000a42: - assume {:captureState "addr:0x760"}true; + assume {:captureState "addr:l00000a42"} true; R0, Gamma_R0 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%00000a4d"} true; goto l00000a2d; l00000a4f: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000a4f"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x74c"}true; + assume {:captureState "%00000a5a"} true; goto l00000a2d; l00000a60: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l00000a60"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%00000a6b"} true; goto l00000a2d; l00000a2d: - assume {:captureState "addr:0x768"}true; + assume {:captureState "addr:l00000a2d"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/nestedif/gcc_pic/nestedif.expected b/src/test/correct/nestedif/gcc_pic/nestedif.expected index 0980d9726..d94363d97 100644 --- a/src/test/correct/nestedif/gcc_pic/nestedif.expected +++ b/src/test/correct/nestedif/gcc_pic/nestedif.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1928bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1928bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -201,13 +201,13 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000009b7"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000009be"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -220,7 +220,7 @@ procedure main() } goto l00000a60; l000009e1: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l000009e1"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#5); @@ -233,7 +233,7 @@ procedure main() } goto l00000a4f; l00000a07: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:l00000a07"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#6); @@ -246,25 +246,25 @@ procedure main() } goto l00000a42; l00000a42: - assume {:captureState "addr:0x760"}true; + assume {:captureState "addr:l00000a42"} true; R0, Gamma_R0 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%00000a4d"} true; goto l00000a2d; l00000a4f: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000a4f"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x74c"}true; + assume {:captureState "%00000a5a"} true; goto l00000a2d; l00000a60: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l00000a60"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%00000a6b"} true; goto l00000a2d; l00000a2d: - assume {:captureState "addr:0x768"}true; + assume {:captureState "addr:l00000a2d"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/no_interference_update_x/clang/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/clang/no_interference_update_x.expected index 02cb1d620..3d075bbc1 100644 --- a/src/test/correct/no_interference_update_x/clang/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/clang/no_interference_update_x.expected @@ -1,37 +1,37 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -72,7 +72,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -80,12 +80,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); @@ -185,7 +185,7 @@ procedure main() { var y_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -193,7 +193,7 @@ procedure main() y_old := memory_load32_le(mem, $y_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert (memory_load32_le(mem, $y_addr) == y_old); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000002ce"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_x/clang_O2/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/clang_O2/no_interference_update_x.expected index 9eb531be8..05dd01c87 100644 --- a/src/test/correct/no_interference_update_x/clang_O2/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/clang_O2/no_interference_update_x.expected @@ -1,37 +1,37 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -72,7 +72,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -80,12 +80,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); @@ -185,7 +185,7 @@ procedure main() { var y_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -194,6 +194,6 @@ procedure main() y_old := memory_load32_le(mem, $y_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); assert (memory_load32_le(mem, $y_addr) == y_old); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002d3"} true; return; } diff --git a/src/test/correct/no_interference_update_x/clang_no_plt_no_pic/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/clang_no_plt_no_pic/no_interference_update_x.expected index 02cb1d620..6ea1581ee 100644 --- a/src/test/correct/no_interference_update_x/clang_no_plt_no_pic/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/clang_no_plt_no_pic/no_interference_update_x.expected @@ -1,37 +1,37 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -72,7 +72,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -80,12 +80,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); @@ -185,7 +185,7 @@ procedure main() { var y_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -193,7 +193,7 @@ procedure main() y_old := memory_load32_le(mem, $y_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert (memory_load32_le(mem, $y_addr) == y_old); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000845"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_x/clang_pic/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/clang_pic/no_interference_update_x.expected index d0ee9ad05..cc0e9e8c1 100644 --- a/src/test/correct/no_interference_update_x/clang_pic/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/clang_pic/no_interference_update_x.expected @@ -1,45 +1,45 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -88,7 +88,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -96,12 +96,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); @@ -217,7 +217,7 @@ procedure main() { var y_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); @@ -227,7 +227,7 @@ procedure main() y_old := memory_load32_le(mem, $y_addr); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert (memory_load32_le(mem, $y_addr) == y_old); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000002d9"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_x/gcc/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/gcc/no_interference_update_x.expected index d3d6c65d5..976c54ca5 100644 --- a/src/test/correct/no_interference_update_x/gcc/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/gcc/no_interference_update_x.expected @@ -1,35 +1,35 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -70,7 +70,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -78,12 +78,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); @@ -183,7 +183,7 @@ procedure main() { var y_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -192,7 +192,7 @@ procedure main() y_old := memory_load32_le(mem, $y_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (memory_load32_le(mem, $y_addr) == y_old); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002d8"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_x/gcc_O2/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/gcc_O2/no_interference_update_x.expected index ba8f09dd7..95c686547 100644 --- a/src/test/correct/no_interference_update_x/gcc_O2/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/gcc_O2/no_interference_update_x.expected @@ -1,37 +1,37 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -72,7 +72,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -80,12 +80,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); @@ -185,7 +185,7 @@ procedure main() { var y_old: bv32; lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 1bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -194,6 +194,6 @@ procedure main() y_old := memory_load32_le(mem, $y_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R2); assert (memory_load32_le(mem, $y_addr) == y_old); - assume {:captureState "addr:0x60c"}true; + assume {:captureState "%000001bd"} true; return; } diff --git a/src/test/correct/no_interference_update_x/gcc_no_plt_no_pic/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/gcc_no_plt_no_pic/no_interference_update_x.expected index d3d6c65d5..477cd0244 100644 --- a/src/test/correct/no_interference_update_x/gcc_no_plt_no_pic/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/gcc_no_plt_no_pic/no_interference_update_x.expected @@ -1,35 +1,35 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -70,7 +70,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -78,12 +78,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); @@ -183,7 +183,7 @@ procedure main() { var y_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -192,7 +192,7 @@ procedure main() y_old := memory_load32_le(mem, $y_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (memory_load32_le(mem, $y_addr) == y_old); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%0000085b"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_x/gcc_pic/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/gcc_pic/no_interference_update_x.expected index 66100cb2c..3b9db6a24 100644 --- a/src/test/correct/no_interference_update_x/gcc_pic/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/gcc_pic/no_interference_update_x.expected @@ -1,43 +1,43 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -86,7 +86,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -94,12 +94,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); @@ -215,7 +215,7 @@ procedure main() { var y_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -225,7 +225,7 @@ procedure main() y_old := memory_load32_le(mem, $y_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (memory_load32_le(mem, $y_addr) == y_old); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000002d9"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_y/clang/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/clang/no_interference_update_y.expected index f5d1eaace..2f031f723 100644 --- a/src/test/correct/no_interference_update_y/clang/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/clang/no_interference_update_y.expected @@ -1,37 +1,37 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -72,7 +72,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -80,12 +80,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -185,7 +185,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -193,7 +193,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert (memory_load32_le(mem, $x_addr) == x_old); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000002ce"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_y/clang_O2/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/clang_O2/no_interference_update_y.expected index 6f021c8f0..e2265a10a 100644 --- a/src/test/correct/no_interference_update_y/clang_O2/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/clang_O2/no_interference_update_y.expected @@ -1,37 +1,37 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -72,7 +72,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -80,12 +80,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -185,7 +185,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -194,6 +194,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); assert (memory_load32_le(mem, $x_addr) == x_old); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002d3"} true; return; } diff --git a/src/test/correct/no_interference_update_y/clang_no_plt_no_pic/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/clang_no_plt_no_pic/no_interference_update_y.expected index f5d1eaace..100fbb2a8 100644 --- a/src/test/correct/no_interference_update_y/clang_no_plt_no_pic/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/clang_no_plt_no_pic/no_interference_update_y.expected @@ -1,37 +1,37 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -72,7 +72,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -80,12 +80,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -185,7 +185,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -193,7 +193,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert (memory_load32_le(mem, $x_addr) == x_old); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000845"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_y/clang_pic/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/clang_pic/no_interference_update_y.expected index 69562d75e..c2ed7684d 100644 --- a/src/test/correct/no_interference_update_y/clang_pic/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/clang_pic/no_interference_update_y.expected @@ -1,45 +1,45 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -88,7 +88,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -96,12 +96,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -217,7 +217,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4048bv64)) || L(mem, bvadd64(R9, 4048bv64))); @@ -227,7 +227,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert (memory_load32_le(mem, $x_addr) == x_old); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000002d9"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_y/gcc/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/gcc/no_interference_update_y.expected index 5567fed6b..f860c613f 100644 --- a/src/test/correct/no_interference_update_y/gcc/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/gcc/no_interference_update_y.expected @@ -1,35 +1,35 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -70,7 +70,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -78,12 +78,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -183,7 +183,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -192,7 +192,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (memory_load32_le(mem, $x_addr) == x_old); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002d8"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_y/gcc_O2/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/gcc_O2/no_interference_update_y.expected index 42731f16f..5933f7204 100644 --- a/src/test/correct/no_interference_update_y/gcc_O2/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/gcc_O2/no_interference_update_y.expected @@ -1,37 +1,37 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69656bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69656bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -72,7 +72,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -80,12 +80,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -185,7 +185,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 1bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -194,6 +194,6 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R2); assert (memory_load32_le(mem, $x_addr) == x_old); - assume {:captureState "addr:0x60c"}true; + assume {:captureState "%000001bd"} true; return; } diff --git a/src/test/correct/no_interference_update_y/gcc_no_plt_no_pic/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/gcc_no_plt_no_pic/no_interference_update_y.expected index 5567fed6b..4b982d936 100644 --- a/src/test/correct/no_interference_update_y/gcc_no_plt_no_pic/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/gcc_no_plt_no_pic/no_interference_update_y.expected @@ -1,35 +1,35 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -70,7 +70,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -78,12 +78,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -183,7 +183,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -192,7 +192,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (memory_load32_le(mem, $x_addr) == x_old); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%0000085b"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/no_interference_update_y/gcc_pic/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/gcc_pic/no_interference_update_y.expected index 211747e8a..93d1df00e 100644 --- a/src/test/correct/no_interference_update_y/gcc_pic/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/gcc_pic/no_interference_update_y.expected @@ -1,43 +1,43 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$y_addr: bv64; -axiom {:extern }($y_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $y_addr: bv64; +axiom ($y_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -86,7 +86,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -94,12 +94,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -215,7 +215,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -225,7 +225,7 @@ procedure main() x_old := memory_load32_le(mem, $x_addr); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert (memory_load32_le(mem, $x_addr) == x_old); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000002d9"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/secret_write/clang/secret_write.expected b/src/test/correct/secret_write/clang/secret_write.expected index 034422fdf..1d4b7703e 100644 --- a/src/test/correct/secret_write/clang/secret_write.expected +++ b/src/test/correct/secret_write/clang/secret_write.expected @@ -1,49 +1,49 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69688bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69692bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69688bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69692bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"}bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"}bvsmod32(bv32, bv32) returns (bv32); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -85,7 +85,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -94,13 +94,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); @@ -204,7 +204,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); @@ -214,7 +214,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), true); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000002f5"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R9, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R9, 52bv64)) || L(mem, bvadd64(R9, 52bv64))); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; @@ -225,7 +225,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%0000030a"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R10, Gamma_R10 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); @@ -237,7 +237,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 60bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 60bv64), Gamma_R10); assert ((bvadd64(R8, 60bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%00000323"} true; call rely(); assert (L(mem, bvadd64(R8, 60bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); @@ -245,7 +245,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 60bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 60bv64), true); assert ((bvadd64(R8, 60bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%0000032a"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R9, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R9, 52bv64)) || L(mem, bvadd64(R9, 52bv64))); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; @@ -256,6 +256,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%0000033f"} true; return; } diff --git a/src/test/correct/secret_write/clang_O2/secret_write.expected b/src/test/correct/secret_write/clang_O2/secret_write.expected index 225c6b7b6..b43c831f2 100644 --- a/src/test/correct/secret_write/clang_O2/secret_write.expected +++ b/src/test/correct/secret_write/clang_O2/secret_write.expected @@ -1,47 +1,47 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69688bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69692bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69688bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69692bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"}bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"}bvsmod32(bv32, bv32) returns (bv32); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -83,7 +83,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -92,13 +92,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); @@ -202,7 +202,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; @@ -214,7 +214,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 60bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 60bv64), true); assert ((bvadd64(R8, 60bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000002df"} true; call rely(); assert (L(mem, bvadd64(R9, 52bv64)) ==> Gamma_R10); z_old := memory_load32_le(mem, $z_addr); @@ -222,6 +222,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R10); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%000002e7"} true; return; } diff --git a/src/test/correct/secret_write/clang_no_plt_no_pic/secret_write.expected b/src/test/correct/secret_write/clang_no_plt_no_pic/secret_write.expected index 034422fdf..d90604b7c 100644 --- a/src/test/correct/secret_write/clang_no_plt_no_pic/secret_write.expected +++ b/src/test/correct/secret_write/clang_no_plt_no_pic/secret_write.expected @@ -1,49 +1,49 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69688bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69692bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69688bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69692bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"}bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"}bvsmod32(bv32, bv32) returns (bv32); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -85,7 +85,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -94,13 +94,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); @@ -204,7 +204,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); @@ -214,7 +214,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), true); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000008ec"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R9, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R9, 52bv64)) || L(mem, bvadd64(R9, 52bv64))); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; @@ -225,7 +225,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000901"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R10, Gamma_R10 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); @@ -237,7 +237,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 60bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 60bv64), Gamma_R10); assert ((bvadd64(R8, 60bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%0000091a"} true; call rely(); assert (L(mem, bvadd64(R8, 60bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); @@ -245,7 +245,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 60bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 60bv64), true); assert ((bvadd64(R8, 60bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%00000921"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R9, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R9, 52bv64)) || L(mem, bvadd64(R9, 52bv64))); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; @@ -256,6 +256,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000936"} true; return; } diff --git a/src/test/correct/secret_write/clang_pic/secret_write.expected b/src/test/correct/secret_write/clang_pic/secret_write.expected index 4baf62826..ab5b6efc8 100644 --- a/src/test/correct/secret_write/clang_pic/secret_write.expected +++ b/src/test/correct/secret_write/clang_pic/secret_write.expected @@ -1,57 +1,57 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69688bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69692bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69688bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69692bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"}bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"}bvsmod32(bv32, bv32) returns (bv32); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -117,7 +117,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69566bv64) == 0bv8); free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -126,13 +126,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); @@ -284,7 +284,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4024bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4024bv64)) || L(mem, bvadd64(R9, 4024bv64))); @@ -296,7 +296,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R9, 0bv32), gamma_store32(Gamma_mem, R9, true); assert ((R9 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%00000308"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R9)), (gamma_load32(Gamma_mem, R9) || L(mem, R9)); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; @@ -307,7 +307,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert ((R9 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x76c"}true; + assume {:captureState "%0000031d"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4048bv64)) || L(mem, bvadd64(R8, 4048bv64))); @@ -323,7 +323,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R8, R10[32:0]), gamma_store32(Gamma_mem, R8, Gamma_R10); assert ((R8 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%00000344"} true; call rely(); assert (L(mem, R8) ==> true); z_old := memory_load32_le(mem, $z_addr); @@ -331,7 +331,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R8, 0bv32), gamma_store32(Gamma_mem, R8, true); assert ((R8 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x788"}true; + assume {:captureState "%0000034b"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R9)), (gamma_load32(Gamma_mem, R9) || L(mem, R9)); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; @@ -342,6 +342,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert ((R9 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x794"}true; + assume {:captureState "%00000360"} true; return; } diff --git a/src/test/correct/secret_write/gcc/secret_write.expected b/src/test/correct/secret_write/gcc/secret_write.expected index 80e69648c..79a5d1522 100644 --- a/src/test/correct/secret_write/gcc/secret_write.expected +++ b/src/test/correct/secret_write/gcc/secret_write.expected @@ -1,45 +1,45 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69660bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69656bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69660bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69656bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"}bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"}bvsmod32(bv32, bv32) returns (bv32); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -81,7 +81,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -90,13 +90,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); @@ -200,7 +200,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -210,7 +210,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%0000032a"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -225,7 +225,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%00000355"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 28bv64), Gamma_R0; call rely(); @@ -239,7 +239,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x750"}true; + assume {:captureState "%0000037a"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -249,7 +249,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%0000038c"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -264,7 +264,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%000003b7"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/secret_write/gcc_O2/secret_write.expected b/src/test/correct/secret_write/gcc_O2/secret_write.expected index fc00e6e23..2fc76ef05 100644 --- a/src/test/correct/secret_write/gcc_O2/secret_write.expected +++ b/src/test/correct/secret_write/gcc_O2/secret_write.expected @@ -1,47 +1,47 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_R3: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }R3: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69660bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_R3: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } R3: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69660bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"}bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"}bvsmod32(bv32, bv32) returns (bv32); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -83,7 +83,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -92,13 +92,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); @@ -202,7 +202,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R3, Gamma_R3 := 2bv64, true; @@ -214,7 +214,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), true); assert ((bvadd64(R1, 20bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x610"}true; + assume {:captureState "%000001c2"} true; call rely(); assert (L(mem, bvadd64(R2, 4bv64)) ==> Gamma_R3); z_old := memory_load32_le(mem, $z_addr); @@ -222,6 +222,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R2, 4bv64), R3[32:0]), gamma_store32(Gamma_mem, bvadd64(R2, 4bv64), Gamma_R3); assert ((bvadd64(R2, 4bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x614"}true; + assume {:captureState "%000001ca"} true; return; } diff --git a/src/test/correct/secret_write/gcc_no_plt_no_pic/secret_write.expected b/src/test/correct/secret_write/gcc_no_plt_no_pic/secret_write.expected index 80e69648c..5de4303c7 100644 --- a/src/test/correct/secret_write/gcc_no_plt_no_pic/secret_write.expected +++ b/src/test/correct/secret_write/gcc_no_plt_no_pic/secret_write.expected @@ -1,45 +1,45 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69660bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69656bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69660bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69656bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"}bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"}bvsmod32(bv32, bv32) returns (bv32); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -81,7 +81,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -90,13 +90,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); @@ -200,7 +200,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -210,7 +210,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000009b8"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -225,7 +225,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%000009e3"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 28bv64), Gamma_R0; call rely(); @@ -239,7 +239,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x750"}true; + assume {:captureState "%00000a08"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -249,7 +249,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%00000a1a"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -264,7 +264,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%00000a45"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/secret_write/gcc_pic/secret_write.expected b/src/test/correct/secret_write/gcc_pic/secret_write.expected index dfdaf6ea3..26aaecbce 100644 --- a/src/test/correct/secret_write/gcc_pic/secret_write.expected +++ b/src/test/correct/secret_write/gcc_pic/secret_write.expected @@ -1,53 +1,53 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69660bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69656bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69660bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69656bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"}bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"}bvsmod32(bv32, bv32) returns (bv32); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -113,7 +113,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -122,13 +122,13 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); @@ -280,7 +280,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4048bv64)) || L(mem, bvadd64(R0, 4048bv64))); @@ -291,7 +291,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%0000032b"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4048bv64)) || L(mem, bvadd64(R0, 4048bv64))); @@ -308,7 +308,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%00000358"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -324,7 +324,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x790"}true; + assume {:captureState "%0000037f"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -335,7 +335,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x79c"}true; + assume {:captureState "%00000392"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4048bv64)) || L(mem, bvadd64(R0, 4048bv64))); @@ -352,7 +352,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert bvsge32(memory_load32_le(mem, $z_addr), z_old); - assume {:captureState "addr:0x7b8"}true; + assume {:captureState "%000003bf"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/simple_jump/clang/simple_jump.expected b/src/test/correct/simple_jump/clang/simple_jump.expected index 32e9685b4..a6d221d75 100644 --- a/src/test/correct/simple_jump/clang/simple_jump.expected +++ b/src/test/correct/simple_jump/clang/simple_jump.expected @@ -1,46 +1,46 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1892bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1892bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,13 +199,13 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000002f1"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002fe"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967290bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934587bv33))), (Gamma_R8 && Gamma_#4); @@ -231,16 +231,16 @@ procedure main() } goto l0000034b; l0000034b: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l0000034b"} true; goto l0000034c; l0000034c: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l0000034c"} true; R8, Gamma_R8 := 6bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%0000035a"} true; goto l00000334; l00000334: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:l00000334"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/simple_jump/clang_O2/simple_jump.expected b/src/test/correct/simple_jump/clang_O2/simple_jump.expected index 863d7bd46..dfc8a4e7d 100644 --- a/src/test/correct/simple_jump/clang_O2/simple_jump.expected +++ b/src/test/correct/simple_jump/clang_O2/simple_jump.expected @@ -1,14 +1,14 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1840bv64); -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1840bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/simple_jump/clang_no_plt_no_pic/simple_jump.expected b/src/test/correct/simple_jump/clang_no_plt_no_pic/simple_jump.expected index 8090021a9..6fcd81902 100644 --- a/src/test/correct/simple_jump/clang_no_plt_no_pic/simple_jump.expected +++ b/src/test/correct/simple_jump/clang_no_plt_no_pic/simple_jump.expected @@ -1,46 +1,46 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1892bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1892bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,13 +199,13 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000903"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000910"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967290bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934587bv33))), (Gamma_R8 && Gamma_#4); @@ -231,16 +231,16 @@ procedure main() } goto l0000095d; l0000095d: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l0000095d"} true; goto l0000095e; l0000095e: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l0000095e"} true; R8, Gamma_R8 := 6bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%0000096c"} true; goto l00000946; l00000946: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:l00000946"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/simple_jump/clang_pic/simple_jump.expected b/src/test/correct/simple_jump/clang_pic/simple_jump.expected index 8090021a9..6fcd81902 100644 --- a/src/test/correct/simple_jump/clang_pic/simple_jump.expected +++ b/src/test/correct/simple_jump/clang_pic/simple_jump.expected @@ -1,46 +1,46 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1892bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1892bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,13 +199,13 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000903"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000910"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967290bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934587bv33))), (Gamma_R8 && Gamma_#4); @@ -231,16 +231,16 @@ procedure main() } goto l0000095d; l0000095d: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l0000095d"} true; goto l0000095e; l0000095e: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l0000095e"} true; R8, Gamma_R8 := 6bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%0000096c"} true; goto l00000946; l00000946: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:l00000946"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/simple_jump/gcc/simple_jump.expected b/src/test/correct/simple_jump/gcc/simple_jump.expected index 260f165dc..f38dfebe9 100644 --- a/src/test/correct/simple_jump/gcc/simple_jump.expected +++ b/src/test/correct/simple_jump/gcc/simple_jump.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1876bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1876bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -197,11 +197,11 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000002e7"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#4); @@ -214,13 +214,13 @@ procedure main() } goto l0000031f; l0000031f: - assume {:captureState "addr:0x72c"}true; + assume {:captureState "addr:l0000031f"} true; R0, Gamma_R0 := 6bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x730"}true; + assume {:captureState "%0000032a"} true; goto l0000030a; l0000030a: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l0000030a"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/simple_jump/gcc_O2/simple_jump.expected b/src/test/correct/simple_jump/gcc_O2/simple_jump.expected index 418f9a5da..db578d839 100644 --- a/src/test/correct/simple_jump/gcc_O2/simple_jump.expected +++ b/src/test/correct/simple_jump/gcc_O2/simple_jump.expected @@ -1,14 +1,14 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1896bv64); -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1896bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/simple_jump/gcc_no_plt_no_pic/simple_jump.expected b/src/test/correct/simple_jump/gcc_no_plt_no_pic/simple_jump.expected index fd5d1056b..4f0549236 100644 --- a/src/test/correct/simple_jump/gcc_no_plt_no_pic/simple_jump.expected +++ b/src/test/correct/simple_jump/gcc_no_plt_no_pic/simple_jump.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1876bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1876bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -197,11 +197,11 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000008be"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#4); @@ -214,13 +214,13 @@ procedure main() } goto l000008f6; l000008f6: - assume {:captureState "addr:0x72c"}true; + assume {:captureState "addr:l000008f6"} true; R0, Gamma_R0 := 6bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x730"}true; + assume {:captureState "%00000901"} true; goto l000008e1; l000008e1: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l000008e1"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/simple_jump/gcc_pic/simple_jump.expected b/src/test/correct/simple_jump/gcc_pic/simple_jump.expected index fd5d1056b..4f0549236 100644 --- a/src/test/correct/simple_jump/gcc_pic/simple_jump.expected +++ b/src/test/correct/simple_jump/gcc_pic/simple_jump.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1876bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1876bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -197,11 +197,11 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000008be"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#4); @@ -214,13 +214,13 @@ procedure main() } goto l000008f6; l000008f6: - assume {:captureState "addr:0x72c"}true; + assume {:captureState "addr:l000008f6"} true; R0, Gamma_R0 := 6bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x730"}true; + assume {:captureState "%00000901"} true; goto l000008e1; l000008e1: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l000008e1"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/switch/clang/switch.expected b/src/test/correct/switch/clang/switch.expected index 5d685847f..bb6a2c6e9 100644 --- a/src/test/correct/switch/clang/switch.expected +++ b/src/test/correct/switch/clang/switch.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1936bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1936bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,16 +199,16 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000323"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%0000032a"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000339"} true; #4, Gamma_#4 := bvadd32(R8[32:0], 4294967294bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934591bv33))), (Gamma_R8 && Gamma_#4); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#4, 1bv32)), bvadd33(zero_extend1_32(R8[32:0]), 4294967295bv33))), (Gamma_R8 && Gamma_#4); @@ -233,10 +233,10 @@ procedure main() } goto l0000039a; l0000039a: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l0000039a"} true; goto l0000039b; l0000039b: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l0000039b"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #5, Gamma_#5 := bvadd32(R8[32:0], 4294967292bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934589bv33))), (Gamma_R8 && Gamma_#5); @@ -262,28 +262,28 @@ procedure main() } goto l000003d7; l00000389: - assume {:captureState "addr:0x768"}true; + assume {:captureState "addr:l00000389"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x76c"}true; + assume {:captureState "%00000394"} true; goto l0000037b; l000003d7: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:l000003d7"} true; goto l000003d8; l000003d8: - assume {:captureState "addr:0x750"}true; + assume {:captureState "addr:l000003d8"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000003e6"} true; goto l00000368; l00000368: - assume {:captureState "addr:0x75c"}true; + assume {:captureState "addr:l00000368"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%00000378"} true; goto l0000037b; l0000037b: - assume {:captureState "addr:0x774"}true; + assume {:captureState "addr:l0000037b"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/switch/clang_O2/switch.expected b/src/test/correct/switch/clang_O2/switch.expected index 6ca38a2b2..a691307d3 100644 --- a/src/test/correct/switch/clang_O2/switch.expected +++ b/src/test/correct/switch/clang_O2/switch.expected @@ -1,12 +1,12 @@ -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }mem: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1836bv64); -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1836bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -47,7 +47,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,9 +56,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -152,6 +152,6 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; return; } diff --git a/src/test/correct/switch/clang_no_plt_no_pic/switch.expected b/src/test/correct/switch/clang_no_plt_no_pic/switch.expected index f59c57b1d..f42ab7744 100644 --- a/src/test/correct/switch/clang_no_plt_no_pic/switch.expected +++ b/src/test/correct/switch/clang_no_plt_no_pic/switch.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1936bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1936bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,16 +199,16 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000009d8"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000009df"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%000009ee"} true; #4, Gamma_#4 := bvadd32(R8[32:0], 4294967294bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934591bv33))), (Gamma_R8 && Gamma_#4); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#4, 1bv32)), bvadd33(zero_extend1_32(R8[32:0]), 4294967295bv33))), (Gamma_R8 && Gamma_#4); @@ -233,10 +233,10 @@ procedure main() } goto l00000a4f; l00000a4f: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l00000a4f"} true; goto l00000a50; l00000a50: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000a50"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #5, Gamma_#5 := bvadd32(R8[32:0], 4294967292bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934589bv33))), (Gamma_R8 && Gamma_#5); @@ -262,28 +262,28 @@ procedure main() } goto l00000a8c; l00000a3e: - assume {:captureState "addr:0x768"}true; + assume {:captureState "addr:l00000a3e"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x76c"}true; + assume {:captureState "%00000a49"} true; goto l00000a30; l00000a8c: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:l00000a8c"} true; goto l00000a8d; l00000a8d: - assume {:captureState "addr:0x750"}true; + assume {:captureState "addr:l00000a8d"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%00000a9b"} true; goto l00000a1d; l00000a1d: - assume {:captureState "addr:0x75c"}true; + assume {:captureState "addr:l00000a1d"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%00000a2d"} true; goto l00000a30; l00000a30: - assume {:captureState "addr:0x774"}true; + assume {:captureState "addr:l00000a30"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/switch/clang_pic/switch.expected b/src/test/correct/switch/clang_pic/switch.expected index f59c57b1d..f42ab7744 100644 --- a/src/test/correct/switch/clang_pic/switch.expected +++ b/src/test/correct/switch/clang_pic/switch.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1936bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1936bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,16 +199,16 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000009d8"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000009df"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%000009ee"} true; #4, Gamma_#4 := bvadd32(R8[32:0], 4294967294bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934591bv33))), (Gamma_R8 && Gamma_#4); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#4, 1bv32)), bvadd33(zero_extend1_32(R8[32:0]), 4294967295bv33))), (Gamma_R8 && Gamma_#4); @@ -233,10 +233,10 @@ procedure main() } goto l00000a4f; l00000a4f: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l00000a4f"} true; goto l00000a50; l00000a50: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000a50"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #5, Gamma_#5 := bvadd32(R8[32:0], 4294967292bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934589bv33))), (Gamma_R8 && Gamma_#5); @@ -262,28 +262,28 @@ procedure main() } goto l00000a8c; l00000a3e: - assume {:captureState "addr:0x768"}true; + assume {:captureState "addr:l00000a3e"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x76c"}true; + assume {:captureState "%00000a49"} true; goto l00000a30; l00000a8c: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:l00000a8c"} true; goto l00000a8d; l00000a8d: - assume {:captureState "addr:0x750"}true; + assume {:captureState "addr:l00000a8d"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%00000a9b"} true; goto l00000a1d; l00000a1d: - assume {:captureState "addr:0x75c"}true; + assume {:captureState "addr:l00000a1d"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%00000a2d"} true; goto l00000a30; l00000a30: - assume {:captureState "addr:0x774"}true; + assume {:captureState "addr:l00000a30"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/switch/gcc/switch.expected b/src/test/correct/switch/gcc/switch.expected index 7ed50a4be..1c1f4e5b3 100644 --- a/src/test/correct/switch/gcc/switch.expected +++ b/src/test/correct/switch/gcc/switch.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1916bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1916bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,13 +199,13 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%0000030f"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000316"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#4); @@ -218,7 +218,7 @@ procedure main() } goto l0000036b; l0000036b: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l0000036b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#5); @@ -231,25 +231,25 @@ procedure main() } goto l00000391; l0000035c: - assume {:captureState "addr:0x750"}true; + assume {:captureState "addr:l0000035c"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%00000367"} true; goto l0000034c; l00000391: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000391"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%0000039c"} true; goto l00000339; l00000339: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:l00000339"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000349"} true; goto l0000034c; l0000034c: - assume {:captureState "addr:0x75c"}true; + assume {:captureState "addr:l0000034c"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/switch/gcc_O2/switch.expected b/src/test/correct/switch/gcc_O2/switch.expected index cf806e8fd..9c7036705 100644 --- a/src/test/correct/switch/gcc_O2/switch.expected +++ b/src/test/correct/switch/gcc_O2/switch.expected @@ -1,12 +1,12 @@ -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }mem: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1896bv64); -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1896bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -47,7 +47,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,9 +56,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -152,6 +152,6 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; return; } diff --git a/src/test/correct/switch/gcc_no_plt_no_pic/switch.expected b/src/test/correct/switch/gcc_no_plt_no_pic/switch.expected index 5418587da..c5cfde371 100644 --- a/src/test/correct/switch/gcc_no_plt_no_pic/switch.expected +++ b/src/test/correct/switch/gcc_no_plt_no_pic/switch.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1916bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1916bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,13 +199,13 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%0000096e"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000975"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#4); @@ -218,7 +218,7 @@ procedure main() } goto l000009ca; l000009ca: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l000009ca"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#5); @@ -231,25 +231,25 @@ procedure main() } goto l000009f0; l000009bb: - assume {:captureState "addr:0x750"}true; + assume {:captureState "addr:l000009bb"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000009c6"} true; goto l000009ab; l000009f0: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l000009f0"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%000009fb"} true; goto l00000998; l00000998: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:l00000998"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%000009a8"} true; goto l000009ab; l000009ab: - assume {:captureState "addr:0x75c"}true; + assume {:captureState "addr:l000009ab"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/switch/gcc_pic/switch.expected b/src/test/correct/switch/gcc_pic/switch.expected index 5418587da..c5cfde371 100644 --- a/src/test/correct/switch/gcc_pic/switch.expected +++ b/src/test/correct/switch/gcc_pic/switch.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1916bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1916bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,13 +199,13 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%0000096e"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%00000975"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#4); @@ -218,7 +218,7 @@ procedure main() } goto l000009ca; l000009ca: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l000009ca"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#5); @@ -231,25 +231,25 @@ procedure main() } goto l000009f0; l000009bb: - assume {:captureState "addr:0x750"}true; + assume {:captureState "addr:l000009bb"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000009c6"} true; goto l000009ab; l000009f0: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l000009f0"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%000009fb"} true; goto l00000998; l00000998: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:l00000998"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%000009a8"} true; goto l000009ab; l000009ab: - assume {:captureState "addr:0x75c"}true; + assume {:captureState "addr:l000009ab"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/switch2/clang_O2/switch2.expected b/src/test/correct/switch2/clang_O2/switch2.expected index fc05afa85..00ab15c63 100644 --- a/src/test/correct/switch2/clang_O2/switch2.expected +++ b/src/test/correct/switch2/clang_O2/switch2.expected @@ -1,11 +1,11 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }mem: [bv64]bv8; -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } mem: [bv64]bv8; +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -46,7 +46,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -55,9 +55,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -152,6 +152,6 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x71c"}true; + assume {:captureState "addr:lmain"} true; return; } diff --git a/src/test/correct/switch2/gcc/switch2.expected b/src/test/correct/switch2/gcc/switch2.expected index 2dd4115fb..979e96843 100644 --- a/src/test/correct/switch2/gcc/switch2.expected +++ b/src/test/correct/switch2/gcc/switch2.expected @@ -1,65 +1,65 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"}bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,7 +100,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,9 +109,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -237,20 +237,20 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x71c"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000386"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%0000038c"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%0000039e"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%000003a6"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), true); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%000003ad"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#5); @@ -263,13 +263,13 @@ procedure main() } goto l00000408; l000003d0: - assume {:captureState "addr:0x7bc"}true; + assume {:captureState "addr:l000003d0"} true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x7c0"}true; + assume {:captureState "%000003e0"} true; goto l000003e2; l00000408: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000408"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#6); @@ -282,7 +282,7 @@ procedure main() } goto l00000430; l00000430: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000430"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #7, Gamma_#7 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#7); @@ -295,7 +295,7 @@ procedure main() } goto l00000467; l00000467: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:l00000467"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #8, Gamma_#8 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#8); @@ -308,7 +308,7 @@ procedure main() } goto l0000048f; l0000048f: - assume {:captureState "addr:0x760"}true; + assume {:captureState "addr:l0000048f"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #9, Gamma_#9 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#9); @@ -321,17 +321,17 @@ procedure main() } goto l000004e2; l000004b0: - assume {:captureState "addr:0x794"}true; + assume {:captureState "addr:l000004b0"} true; R30, Gamma_R30 := 1944bv64, true; call r(); goto l000004bc; l000004bc: - assume {:captureState "addr:0x798"}true; + assume {:captureState "addr:l000004bc"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x798"}true; + assume {:captureState "%000004c2"} true; goto l000004c4; l000004e2: - assume {:captureState "addr:0x76c"}true; + assume {:captureState "addr:l000004e2"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #10, Gamma_#10 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#10); @@ -344,7 +344,7 @@ procedure main() } goto l0000050a; l0000050a: - assume {:captureState "addr:0x778"}true; + assume {:captureState "addr:l0000050a"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #11, Gamma_#11 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#11); @@ -357,13 +357,13 @@ procedure main() } goto l00000530; l000004c4: - assume {:captureState "addr:0x79c"}true; + assume {:captureState "addr:l000004c4"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x7a0"}true; + assume {:captureState "%000004cf"} true; goto l000003f1; l00000530: - assume {:captureState "addr:0x784"}true; + assume {:captureState "addr:l00000530"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #12, Gamma_#12 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#12); @@ -376,28 +376,28 @@ procedure main() } goto l00000556; l000004d5: - assume {:captureState "addr:0x7a8"}true; + assume {:captureState "addr:l000004d5"} true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x7ac"}true; + assume {:captureState "%000004e0"} true; goto l00000451; l00000451: - assume {:captureState "addr:0x7b0"}true; + assume {:captureState "addr:l00000451"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x7b4"}true; + assume {:captureState "%00000461"} true; goto l000003f1; l00000556: - assume {:captureState "addr:0x790"}true; + assume {:captureState "addr:l00000556"} true; goto l000003e2; l000003e2: - assume {:captureState "addr:0x7c4"}true; + assume {:captureState "addr:l000003e2"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x7c8"}true; + assume {:captureState "%000003ed"} true; goto l000003f1; l000003f1: - assume {:captureState "addr:0x7d0"}true; + assume {:captureState "addr:l000003f1"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 48bv64), Gamma_R31; @@ -480,7 +480,7 @@ procedure r() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lr: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lr"} true; R0, Gamma_R0 := 1bv64, true; return; } diff --git a/src/test/correct/switch2/gcc_O2/switch2.expected b/src/test/correct/switch2/gcc_O2/switch2.expected index 40a765b0b..3b9fce4b6 100644 --- a/src/test/correct/switch2/gcc_O2/switch2.expected +++ b/src/test/correct/switch2/gcc_O2/switch2.expected @@ -1,11 +1,11 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }mem: [bv64]bv8; -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } mem: [bv64]bv8; +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -46,7 +46,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -55,9 +55,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -152,6 +152,6 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; return; } diff --git a/src/test/correct/switch2/gcc_no_plt_no_pic/switch2.expected b/src/test/correct/switch2/gcc_no_plt_no_pic/switch2.expected index 3128f788a..f2edcd64a 100644 --- a/src/test/correct/switch2/gcc_no_plt_no_pic/switch2.expected +++ b/src/test/correct/switch2/gcc_no_plt_no_pic/switch2.expected @@ -1,65 +1,65 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"}bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,7 +100,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,9 +109,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -237,20 +237,20 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x71c"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000be5"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000beb"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000bfd"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000c05"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), true); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%00000c0c"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#5); @@ -263,13 +263,13 @@ procedure main() } goto l00000c67; l00000c2f: - assume {:captureState "addr:0x7bc"}true; + assume {:captureState "addr:l00000c2f"} true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x7c0"}true; + assume {:captureState "%00000c3f"} true; goto l00000c41; l00000c67: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000c67"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#6); @@ -282,7 +282,7 @@ procedure main() } goto l00000c8f; l00000c8f: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000c8f"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #7, Gamma_#7 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#7); @@ -295,7 +295,7 @@ procedure main() } goto l00000cc6; l00000cc6: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:l00000cc6"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #8, Gamma_#8 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#8); @@ -308,7 +308,7 @@ procedure main() } goto l00000cee; l00000cee: - assume {:captureState "addr:0x760"}true; + assume {:captureState "addr:l00000cee"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #9, Gamma_#9 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#9); @@ -321,17 +321,17 @@ procedure main() } goto l00000d41; l00000d0f: - assume {:captureState "addr:0x794"}true; + assume {:captureState "addr:l00000d0f"} true; R30, Gamma_R30 := 1944bv64, true; call r(); goto l00000d1b; l00000d1b: - assume {:captureState "addr:0x798"}true; + assume {:captureState "addr:l00000d1b"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x798"}true; + assume {:captureState "%00000d21"} true; goto l00000d23; l00000d41: - assume {:captureState "addr:0x76c"}true; + assume {:captureState "addr:l00000d41"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #10, Gamma_#10 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#10); @@ -344,7 +344,7 @@ procedure main() } goto l00000d69; l00000d69: - assume {:captureState "addr:0x778"}true; + assume {:captureState "addr:l00000d69"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #11, Gamma_#11 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#11); @@ -357,13 +357,13 @@ procedure main() } goto l00000d8f; l00000d23: - assume {:captureState "addr:0x79c"}true; + assume {:captureState "addr:l00000d23"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x7a0"}true; + assume {:captureState "%00000d2e"} true; goto l00000c50; l00000d8f: - assume {:captureState "addr:0x784"}true; + assume {:captureState "addr:l00000d8f"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #12, Gamma_#12 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#12); @@ -376,28 +376,28 @@ procedure main() } goto l00000db5; l00000d34: - assume {:captureState "addr:0x7a8"}true; + assume {:captureState "addr:l00000d34"} true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x7ac"}true; + assume {:captureState "%00000d3f"} true; goto l00000cb0; l00000cb0: - assume {:captureState "addr:0x7b0"}true; + assume {:captureState "addr:l00000cb0"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x7b4"}true; + assume {:captureState "%00000cc0"} true; goto l00000c50; l00000db5: - assume {:captureState "addr:0x790"}true; + assume {:captureState "addr:l00000db5"} true; goto l00000c41; l00000c41: - assume {:captureState "addr:0x7c4"}true; + assume {:captureState "addr:l00000c41"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x7c8"}true; + assume {:captureState "%00000c4c"} true; goto l00000c50; l00000c50: - assume {:captureState "addr:0x7d0"}true; + assume {:captureState "addr:l00000c50"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 48bv64), Gamma_R31; @@ -480,7 +480,7 @@ procedure r() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lr: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lr"} true; R0, Gamma_R0 := 1bv64, true; return; } diff --git a/src/test/correct/switch2/gcc_pic/switch2.expected b/src/test/correct/switch2/gcc_pic/switch2.expected index 3128f788a..f2edcd64a 100644 --- a/src/test/correct/switch2/gcc_pic/switch2.expected +++ b/src/test/correct/switch2/gcc_pic/switch2.expected @@ -1,65 +1,65 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"}bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,7 +100,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,9 +109,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -237,20 +237,20 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x71c"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000be5"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000beb"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000bfd"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000c05"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), true); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%00000c0c"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#5); @@ -263,13 +263,13 @@ procedure main() } goto l00000c67; l00000c2f: - assume {:captureState "addr:0x7bc"}true; + assume {:captureState "addr:l00000c2f"} true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x7c0"}true; + assume {:captureState "%00000c3f"} true; goto l00000c41; l00000c67: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000c67"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#6); @@ -282,7 +282,7 @@ procedure main() } goto l00000c8f; l00000c8f: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000c8f"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #7, Gamma_#7 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#7); @@ -295,7 +295,7 @@ procedure main() } goto l00000cc6; l00000cc6: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:l00000cc6"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #8, Gamma_#8 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#8); @@ -308,7 +308,7 @@ procedure main() } goto l00000cee; l00000cee: - assume {:captureState "addr:0x760"}true; + assume {:captureState "addr:l00000cee"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #9, Gamma_#9 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#9); @@ -321,17 +321,17 @@ procedure main() } goto l00000d41; l00000d0f: - assume {:captureState "addr:0x794"}true; + assume {:captureState "addr:l00000d0f"} true; R30, Gamma_R30 := 1944bv64, true; call r(); goto l00000d1b; l00000d1b: - assume {:captureState "addr:0x798"}true; + assume {:captureState "addr:l00000d1b"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x798"}true; + assume {:captureState "%00000d21"} true; goto l00000d23; l00000d41: - assume {:captureState "addr:0x76c"}true; + assume {:captureState "addr:l00000d41"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #10, Gamma_#10 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#10); @@ -344,7 +344,7 @@ procedure main() } goto l00000d69; l00000d69: - assume {:captureState "addr:0x778"}true; + assume {:captureState "addr:l00000d69"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #11, Gamma_#11 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#11); @@ -357,13 +357,13 @@ procedure main() } goto l00000d8f; l00000d23: - assume {:captureState "addr:0x79c"}true; + assume {:captureState "addr:l00000d23"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x7a0"}true; + assume {:captureState "%00000d2e"} true; goto l00000c50; l00000d8f: - assume {:captureState "addr:0x784"}true; + assume {:captureState "addr:l00000d8f"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #12, Gamma_#12 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#12); @@ -376,28 +376,28 @@ procedure main() } goto l00000db5; l00000d34: - assume {:captureState "addr:0x7a8"}true; + assume {:captureState "addr:l00000d34"} true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x7ac"}true; + assume {:captureState "%00000d3f"} true; goto l00000cb0; l00000cb0: - assume {:captureState "addr:0x7b0"}true; + assume {:captureState "addr:l00000cb0"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x7b4"}true; + assume {:captureState "%00000cc0"} true; goto l00000c50; l00000db5: - assume {:captureState "addr:0x790"}true; + assume {:captureState "addr:l00000db5"} true; goto l00000c41; l00000c41: - assume {:captureState "addr:0x7c4"}true; + assume {:captureState "addr:l00000c41"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x7c8"}true; + assume {:captureState "%00000c4c"} true; goto l00000c50; l00000c50: - assume {:captureState "addr:0x7d0"}true; + assume {:captureState "addr:l00000c50"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 48bv64), Gamma_R31; @@ -480,7 +480,7 @@ procedure r() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lr: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lr"} true; R0, Gamma_R0 := 1bv64, true; return; } diff --git a/src/test/correct/syscall/clang/syscall.expected b/src/test/correct/syscall/clang/syscall.expected index 16febb0c3..63c701a70 100644 --- a/src/test/correct/syscall/clang/syscall.expected +++ b/src/test/correct/syscall/clang/syscall.expected @@ -1,62 +1,62 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1944bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1944bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,9 +106,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure fork(); @@ -286,27 +286,27 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%000002ea"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%000002f0"} true; R29, Gamma_R29 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000002fd"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551608bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551608bv64), Gamma_R0); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%00000305"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%0000030d"} true; R30, Gamma_R30 := 1904bv64, true; call fork(); goto l00000317; l00000317: - assume {:captureState "addr:0x770"}true; + assume {:captureState "addr:l00000317"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x770"}true; + assume {:captureState "%0000031d"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/syscall/clang_no_plt_no_pic/syscall.expected b/src/test/correct/syscall/clang_no_plt_no_pic/syscall.expected index d6e7b2e96..ec5e63070 100644 --- a/src/test/correct/syscall/clang_no_plt_no_pic/syscall.expected +++ b/src/test/correct/syscall/clang_no_plt_no_pic/syscall.expected @@ -1,62 +1,62 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1944bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1944bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,9 +106,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure fork(); @@ -286,27 +286,27 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000902"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000908"} true; R29, Gamma_R29 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%00000915"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551608bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551608bv64), Gamma_R0); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%0000091d"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%00000925"} true; R30, Gamma_R30 := 1904bv64, true; call fork(); goto l0000092f; l0000092f: - assume {:captureState "addr:0x770"}true; + assume {:captureState "addr:l0000092f"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x770"}true; + assume {:captureState "%00000935"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/syscall/clang_pic/syscall.expected b/src/test/correct/syscall/clang_pic/syscall.expected index d6e7b2e96..ec5e63070 100644 --- a/src/test/correct/syscall/clang_pic/syscall.expected +++ b/src/test/correct/syscall/clang_pic/syscall.expected @@ -1,62 +1,62 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1944bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1944bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,9 +106,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure fork(); @@ -286,27 +286,27 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000902"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000908"} true; R29, Gamma_R29 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), true); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%00000915"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551608bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551608bv64), Gamma_R0); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%0000091d"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%00000925"} true; R30, Gamma_R30 := 1904bv64, true; call fork(); goto l0000092f; l0000092f: - assume {:captureState "addr:0x770"}true; + assume {:captureState "addr:l0000092f"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x770"}true; + assume {:captureState "%00000935"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/syscall/gcc/syscall.expected b/src/test/correct/syscall/gcc/syscall.expected index c22fb9300..6e685e564 100644 --- a/src/test/correct/syscall/gcc/syscall.expected +++ b/src/test/correct/syscall/gcc/syscall.expected @@ -1,62 +1,62 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1932bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1932bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,9 +106,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure fork(); @@ -284,25 +284,25 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000002d8"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000002de"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%000002f0"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000002f8"} true; R30, Gamma_R30 := 1896bv64, true; call fork(); goto l00000302; l00000302: - assume {:captureState "addr:0x768"}true; + assume {:captureState "addr:l00000302"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%00000308"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 44bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 44bv64)); R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/syscall/gcc_O2/syscall.expected b/src/test/correct/syscall/gcc_O2/syscall.expected index 29ff7f2b3..1147e7be6 100644 --- a/src/test/correct/syscall/gcc_O2/syscall.expected +++ b/src/test/correct/syscall/gcc_O2/syscall.expected @@ -1,16 +1,16 @@ -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1960bv64); -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1960bv64); +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -51,7 +51,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -60,9 +60,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure fork(); diff --git a/src/test/correct/syscall/gcc_no_plt_no_pic/syscall.expected b/src/test/correct/syscall/gcc_no_plt_no_pic/syscall.expected index 605df38e0..9a1a0f525 100644 --- a/src/test/correct/syscall/gcc_no_plt_no_pic/syscall.expected +++ b/src/test/correct/syscall/gcc_no_plt_no_pic/syscall.expected @@ -1,62 +1,62 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1932bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1932bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,9 +106,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure fork(); @@ -284,25 +284,25 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000008cf"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000008d5"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%000008e7"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000008ef"} true; R30, Gamma_R30 := 1896bv64, true; call fork(); goto l000008f9; l000008f9: - assume {:captureState "addr:0x768"}true; + assume {:captureState "addr:l000008f9"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%000008ff"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 44bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 44bv64)); R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/syscall/gcc_pic/syscall.expected b/src/test/correct/syscall/gcc_pic/syscall.expected index 605df38e0..9a1a0f525 100644 --- a/src/test/correct/syscall/gcc_pic/syscall.expected +++ b/src/test/correct/syscall/gcc_pic/syscall.expected @@ -1,62 +1,62 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R16: bool; -var {:extern }Gamma_R17: bool; -var {:extern }Gamma_R29: bool; -var {:extern }Gamma_R30: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R16: bv64; -var {:extern }R17: bv64; -var {:extern }R29: bv64; -var {:extern }R30: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$_IO_stdin_used_addr: bv64; -axiom {:extern }($_IO_stdin_used_addr == 1932bv64); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R16: bool; +var {:extern } Gamma_R17: bool; +var {:extern } Gamma_R29: bool; +var {:extern } Gamma_R30: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R16: bv64; +var {:extern } R17: bv64; +var {:extern } R29: bv64; +var {:extern } R30: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $_IO_stdin_used_addr: bv64; +axiom ($_IO_stdin_used_addr == 1932bv64); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,9 +106,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure fork(); @@ -284,25 +284,25 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000008cf"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(#4, 8bv64), R30), gamma_store64(Gamma_stack, bvadd64(#4, 8bv64), Gamma_R30); - assume {:captureState "addr:0x754"}true; + assume {:captureState "%000008d5"} true; R31, Gamma_R31 := #4, Gamma_#4; R29, Gamma_R29 := R31, Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x75c"}true; + assume {:captureState "%000008e7"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R1), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R1); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000008ef"} true; R30, Gamma_R30 := 1896bv64, true; call fork(); goto l000008f9; l000008f9: - assume {:captureState "addr:0x768"}true; + assume {:captureState "addr:l000008f9"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%000008ff"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 44bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 44bv64)); R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/using_gamma_conditional/clang/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/clang/using_gamma_conditional.expected index 19b31d637..b28d5fecc 100644 --- a/src/test/correct/using_gamma_conditional/clang/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/clang/using_gamma_conditional.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -87,7 +87,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -95,12 +95,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); @@ -211,10 +211,10 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000002f5"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -242,21 +242,21 @@ procedure main() } goto l00000358; l00000330: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l00000330"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000340"} true; goto l00000343; l00000358: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l00000358"} true; goto l00000359; l00000359: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l00000359"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%00000361"} true; goto l00000343; l00000343: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000343"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/using_gamma_conditional/clang_O2/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/clang_O2/using_gamma_conditional.expected index d44f99374..70a7a92c3 100644 --- a/src/test/correct/using_gamma_conditional/clang_O2/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/clang_O2/using_gamma_conditional.expected @@ -1,40 +1,40 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -75,7 +75,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -83,12 +83,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); @@ -197,7 +197,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); diff --git a/src/test/correct/using_gamma_conditional/clang_no_plt_no_pic/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/clang_no_plt_no_pic/using_gamma_conditional.expected index eb2bb7d65..5bd1f8366 100644 --- a/src/test/correct/using_gamma_conditional/clang_no_plt_no_pic/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/clang_no_plt_no_pic/using_gamma_conditional.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -87,7 +87,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -95,12 +95,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); @@ -211,10 +211,10 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000910"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -242,21 +242,21 @@ procedure main() } goto l00000973; l0000094b: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l0000094b"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%0000095b"} true; goto l0000095e; l00000973: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l00000973"} true; goto l00000974; l00000974: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l00000974"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%0000097c"} true; goto l0000095e; l0000095e: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l0000095e"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/using_gamma_conditional/clang_pic/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/clang_pic/using_gamma_conditional.expected index 3055085a8..02566c5be 100644 --- a/src/test/correct/using_gamma_conditional/clang_pic/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/clang_pic/using_gamma_conditional.expected @@ -1,60 +1,60 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69684bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -103,7 +103,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -111,12 +111,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); @@ -243,10 +243,10 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%000002f9"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4040bv64)) || L(mem, bvadd64(R8, 4040bv64))); @@ -276,21 +276,21 @@ procedure main() } goto l00000363; l0000033b: - assume {:captureState "addr:0x780"}true; + assume {:captureState "addr:l0000033b"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%0000034b"} true; goto l0000034e; l00000363: - assume {:captureState "addr:0x774"}true; + assume {:captureState "addr:l00000363"} true; goto l00000364; l00000364: - assume {:captureState "addr:0x778"}true; + assume {:captureState "addr:l00000364"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%0000036c"} true; goto l0000034e; l0000034e: - assume {:captureState "addr:0x78c"}true; + assume {:captureState "addr:l0000034e"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/using_gamma_conditional/gcc/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/gcc/using_gamma_conditional.expected index 91c5174a3..9c3a5aa73 100644 --- a/src/test/correct/using_gamma_conditional/gcc/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/gcc/using_gamma_conditional.expected @@ -1,38 +1,38 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -73,7 +73,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -81,12 +81,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); @@ -195,7 +195,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -211,14 +211,14 @@ procedure main() } goto l00000309; l000002fa: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l000002fa"} true; R0, Gamma_R0 := 1bv64, true; goto l00000304; l00000309: - assume {:captureState "addr:0x728"}true; + assume {:captureState "addr:l00000309"} true; R0, Gamma_R0 := 0bv64, true; goto l00000304; l00000304: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l00000304"} true; return; } diff --git a/src/test/correct/using_gamma_conditional/gcc_O2/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/gcc_O2/using_gamma_conditional.expected index 91d0231c6..b9ad0a983 100644 --- a/src/test/correct/using_gamma_conditional/gcc_O2/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/gcc_O2/using_gamma_conditional.expected @@ -1,38 +1,38 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -73,7 +73,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -81,12 +81,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); @@ -195,7 +195,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R0, 20bv64))), (gamma_load32(Gamma_mem, bvadd64(R0, 20bv64)) || L(mem, bvadd64(R0, 20bv64))); diff --git a/src/test/correct/using_gamma_conditional/gcc_no_plt_no_pic/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/gcc_no_plt_no_pic/using_gamma_conditional.expected index 1d618a77c..7eff00ef6 100644 --- a/src/test/correct/using_gamma_conditional/gcc_no_plt_no_pic/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/gcc_no_plt_no_pic/using_gamma_conditional.expected @@ -1,38 +1,38 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -73,7 +73,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -81,12 +81,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); @@ -195,7 +195,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -211,14 +211,14 @@ procedure main() } goto l000008c2; l000008b3: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l000008b3"} true; R0, Gamma_R0 := 1bv64, true; goto l000008bd; l000008c2: - assume {:captureState "addr:0x728"}true; + assume {:captureState "addr:l000008c2"} true; R0, Gamma_R0 := 0bv64, true; goto l000008bd; l000008bd: - assume {:captureState "addr:0x734"}true; + assume {:captureState "addr:l000008bd"} true; return; } diff --git a/src/test/correct/using_gamma_conditional/gcc_pic/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/gcc_pic/using_gamma_conditional.expected index 55866c8b9..c801ee5ba 100644 --- a/src/test/correct/using_gamma_conditional/gcc_pic/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/gcc_pic/using_gamma_conditional.expected @@ -1,46 +1,46 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -89,7 +89,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -97,12 +97,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); @@ -227,7 +227,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -244,14 +244,14 @@ procedure main() } goto l0000030a; l000002fb: - assume {:captureState "addr:0x770"}true; + assume {:captureState "addr:l000002fb"} true; R0, Gamma_R0 := 1bv64, true; goto l00000305; l0000030a: - assume {:captureState "addr:0x768"}true; + assume {:captureState "addr:l0000030a"} true; R0, Gamma_R0 := 0bv64, true; goto l00000305; l00000305: - assume {:captureState "addr:0x774"}true; + assume {:captureState "addr:l00000305"} true; return; } diff --git a/src/test/correct/using_gamma_write_z/clang/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/clang/using_gamma_write_z.expected index 5257e2483..d5c6f60ac 100644 --- a/src/test/correct/using_gamma_write_z/clang/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/clang/using_gamma_write_z.expected @@ -1,41 +1,41 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -76,7 +76,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -84,12 +84,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -189,7 +189,7 @@ procedure main() { var Gamma_x_old: bool; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -198,7 +198,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert (Gamma_x_old ==> gamma_load32(Gamma_mem, $x_addr)); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000002ce"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/using_gamma_write_z/clang_O2/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/clang_O2/using_gamma_write_z.expected index 1ad5400b4..94dfe0e17 100644 --- a/src/test/correct/using_gamma_write_z/clang_O2/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/clang_O2/using_gamma_write_z.expected @@ -1,41 +1,41 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -76,7 +76,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -84,12 +84,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -189,7 +189,7 @@ procedure main() { var Gamma_x_old: bool; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -199,6 +199,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); assert ((bvadd64(R8, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert (Gamma_x_old ==> gamma_load32(Gamma_mem, $x_addr)); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002d3"} true; return; } diff --git a/src/test/correct/using_gamma_write_z/clang_no_plt_no_pic/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/clang_no_plt_no_pic/using_gamma_write_z.expected index 5257e2483..5e1b2c563 100644 --- a/src/test/correct/using_gamma_write_z/clang_no_plt_no_pic/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/clang_no_plt_no_pic/using_gamma_write_z.expected @@ -1,41 +1,41 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -76,7 +76,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -84,12 +84,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -189,7 +189,7 @@ procedure main() { var Gamma_x_old: bool; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); @@ -198,7 +198,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 52bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 52bv64), Gamma_R8); assert ((bvadd64(R9, 52bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert (Gamma_x_old ==> gamma_load32(Gamma_mem, $x_addr)); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000845"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/using_gamma_write_z/clang_pic/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/clang_pic/using_gamma_write_z.expected index 9d4f0b023..14214bad0 100644 --- a/src/test/correct/using_gamma_write_z/clang_pic/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/clang_pic/using_gamma_write_z.expected @@ -1,49 +1,49 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69684bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69684bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -92,7 +92,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -100,12 +100,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -221,7 +221,7 @@ procedure main() { var Gamma_x_old: bool; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); @@ -232,7 +232,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); assert ((R9 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert (Gamma_x_old ==> gamma_load32(Gamma_mem, $x_addr)); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000002d9"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/using_gamma_write_z/gcc/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/gcc/using_gamma_write_z.expected index faa535bd0..e7b37f433 100644 --- a/src/test/correct/using_gamma_write_z/gcc/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/gcc/using_gamma_write_z.expected @@ -1,39 +1,39 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -74,7 +74,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -82,12 +82,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -187,7 +187,7 @@ procedure main() { var Gamma_x_old: bool; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -197,7 +197,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert (Gamma_x_old ==> gamma_load32(Gamma_mem, $x_addr)); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002d8"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/using_gamma_write_z/gcc_O2/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/gcc_O2/using_gamma_write_z.expected index 137eb78e6..dd1f6d89b 100644 --- a/src/test/correct/using_gamma_write_z/gcc_O2/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/gcc_O2/using_gamma_write_z.expected @@ -1,41 +1,41 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69656bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69656bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -76,7 +76,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -84,12 +84,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -189,7 +189,7 @@ procedure main() { var Gamma_x_old: bool; lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 1bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -199,6 +199,6 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R2); assert ((bvadd64(R1, 20bv64) == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert (Gamma_x_old ==> gamma_load32(Gamma_mem, $x_addr)); - assume {:captureState "addr:0x60c"}true; + assume {:captureState "%000001bd"} true; return; } diff --git a/src/test/correct/using_gamma_write_z/gcc_no_plt_no_pic/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/gcc_no_plt_no_pic/using_gamma_write_z.expected index faa535bd0..730fa2be4 100644 --- a/src/test/correct/using_gamma_write_z/gcc_no_plt_no_pic/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/gcc_no_plt_no_pic/using_gamma_write_z.expected @@ -1,39 +1,39 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -74,7 +74,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -82,12 +82,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -187,7 +187,7 @@ procedure main() { var Gamma_x_old: bool; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -197,7 +197,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert (Gamma_x_old ==> gamma_load32(Gamma_mem, $x_addr)); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%0000085b"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/using_gamma_write_z/gcc_pic/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/gcc_pic/using_gamma_write_z.expected index 15fdf23f4..24b2a2181 100644 --- a/src/test/correct/using_gamma_write_z/gcc_pic/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/gcc_pic/using_gamma_write_z.expected @@ -1,47 +1,47 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -90,7 +90,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -98,12 +98,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern }guarantee_reflexive() +procedure {:extern } guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -219,7 +219,7 @@ procedure main() { var Gamma_x_old: bool; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -230,7 +230,7 @@ procedure main() mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); assert ((R0 == $z_addr) ==> (L(mem, $x_addr) ==> Gamma_x_old)); assert (Gamma_x_old ==> gamma_load32(Gamma_mem, $x_addr)); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%000002d9"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/incorrect/basicassign/clang/basicassign.expected b/src/test/incorrect/basicassign/clang/basicassign.expected index a768e33c0..dcd284749 100644 --- a/src/test/incorrect/basicassign/clang/basicassign.expected +++ b/src/test/incorrect/basicassign/clang/basicassign.expected @@ -1,48 +1,48 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R11: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R11: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69684bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69692bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R11: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R11: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69684bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69692bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -83,7 +83,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -91,12 +91,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -191,7 +191,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R10, Gamma_R10 := 69632bv64, true; call rely(); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(mem, bvadd64(R10, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R10, 52bv64)) || L(mem, bvadd64(R10, 52bv64))); @@ -199,30 +199,30 @@ procedure main() call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), Gamma_R9); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002f9"} true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> true); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000305"} true; call rely(); R11, Gamma_R11 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 60bv64)) ==> Gamma_R11); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 60bv64), R11[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 60bv64), Gamma_R11); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%00000319"} true; call rely(); R10, Gamma_R10 := zero_extend32_32(memory_load32_le(mem, bvadd64(R10, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R10, 52bv64)) || L(mem, bvadd64(R10, 52bv64))); call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), Gamma_R10); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%00000328"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); call rely(); assert (L(mem, bvadd64(R9, 60bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 60bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 60bv64), Gamma_R8); - assume {:captureState "addr:0x744"}true; + assume {:captureState "%00000337"} true; return; } diff --git a/src/test/incorrect/basicassign/clang_O2/basicassign.expected b/src/test/incorrect/basicassign/clang_O2/basicassign.expected index b9d00d50e..c75852079 100644 --- a/src/test/incorrect/basicassign/clang_O2/basicassign.expected +++ b/src/test/incorrect/basicassign/clang_O2/basicassign.expected @@ -1,46 +1,46 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69684bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69692bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69684bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69692bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -81,7 +81,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -89,12 +89,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -189,7 +189,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; R9, Gamma_R9 := 69632bv64, true; @@ -199,10 +199,10 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%000002eb"} true; call rely(); assert (L(mem, bvadd64(R10, 60bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R10, 60bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R10, 60bv64), Gamma_R8); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%000002f3"} true; return; } diff --git a/src/test/incorrect/basicassign/clang_no_plt_no_pic/basicassign.expected b/src/test/incorrect/basicassign/clang_no_plt_no_pic/basicassign.expected index a768e33c0..96a69ffd6 100644 --- a/src/test/incorrect/basicassign/clang_no_plt_no_pic/basicassign.expected +++ b/src/test/incorrect/basicassign/clang_no_plt_no_pic/basicassign.expected @@ -1,48 +1,48 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R11: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R11: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69684bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69692bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R11: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R11: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69684bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69692bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -83,7 +83,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -91,12 +91,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -191,7 +191,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R10, Gamma_R10 := 69632bv64, true; call rely(); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(mem, bvadd64(R10, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R10, 52bv64)) || L(mem, bvadd64(R10, 52bv64))); @@ -199,30 +199,30 @@ procedure main() call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), Gamma_R9); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000008e6"} true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> true); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), 0bv32), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), true); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%000008f2"} true; call rely(); R11, Gamma_R11 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 60bv64)) ==> Gamma_R11); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 60bv64), R11[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 60bv64), Gamma_R11); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%00000906"} true; call rely(); R10, Gamma_R10 := zero_extend32_32(memory_load32_le(mem, bvadd64(R10, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R10, 52bv64)) || L(mem, bvadd64(R10, 52bv64))); call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 56bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 56bv64), Gamma_R10); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%00000915"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); call rely(); assert (L(mem, bvadd64(R9, 60bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 60bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 60bv64), Gamma_R8); - assume {:captureState "addr:0x744"}true; + assume {:captureState "%00000924"} true; return; } diff --git a/src/test/incorrect/basicassign/clang_pic/basicassign.expected b/src/test/incorrect/basicassign/clang_pic/basicassign.expected index b64b8edc6..90596d82e 100644 --- a/src/test/incorrect/basicassign/clang_pic/basicassign.expected +++ b/src/test/incorrect/basicassign/clang_pic/basicassign.expected @@ -1,56 +1,56 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R11: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R11: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69684bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69692bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R11: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R11: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69684bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69692bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -115,7 +115,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69566bv64) == 0bv8); free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -123,12 +123,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -271,7 +271,7 @@ procedure main() free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -283,12 +283,12 @@ procedure main() call rely(); assert (L(mem, R8) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, R8, R9[32:0]), gamma_store32(Gamma_mem, R8, Gamma_R9); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%00000313"} true; R0, Gamma_R0 := 0bv64, true; call rely(); assert (L(mem, R8) ==> true); mem, Gamma_mem := memory_store32_le(mem, R8, 0bv32), gamma_store32(Gamma_mem, R8, true); - assume {:captureState "addr:0x770"}true; + assume {:captureState "%0000031f"} true; call rely(); R11, Gamma_R11 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); R9, Gamma_R9 := 65536bv64, true; @@ -297,18 +297,18 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R11); mem, Gamma_mem := memory_store32_le(mem, R9, R11[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R11); - assume {:captureState "addr:0x780"}true; + assume {:captureState "%0000033a"} true; call rely(); R10, Gamma_R10 := zero_extend32_32(memory_load32_le(mem, R10)), (gamma_load32(Gamma_mem, R10) || L(mem, R10)); call rely(); assert (L(mem, R8) ==> Gamma_R10); mem, Gamma_mem := memory_store32_le(mem, R8, R10[32:0]), gamma_store32(Gamma_mem, R8, Gamma_R10); - assume {:captureState "addr:0x788"}true; + assume {:captureState "%00000349"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x790"}true; + assume {:captureState "%00000358"} true; return; } diff --git a/src/test/incorrect/basicassign/gcc/basicassign.expected b/src/test/incorrect/basicassign/gcc/basicassign.expected index d3c439a15..ac29f808a 100644 --- a/src/test/incorrect/basicassign/gcc/basicassign.expected +++ b/src/test/incorrect/basicassign/gcc/basicassign.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69660bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69660bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -77,7 +77,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -85,12 +85,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -185,7 +185,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 28bv64), Gamma_R0; call rely(); @@ -195,13 +195,13 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000341"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); assert (L(mem, R0) ==> true); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%00000353"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -211,7 +211,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x74c"}true; + assume {:captureState "%00000378"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 28bv64), Gamma_R0; call rely(); @@ -221,7 +221,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%0000039d"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -231,7 +231,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x77c"}true; + assume {:captureState "%000003c2"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/incorrect/basicassign/gcc_O2/basicassign.expected b/src/test/incorrect/basicassign/gcc_O2/basicassign.expected index ebd579c95..040eea589 100644 --- a/src/test/incorrect/basicassign/gcc_O2/basicassign.expected +++ b/src/test/incorrect/basicassign/gcc_O2/basicassign.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69652bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69656bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69660bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69652bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69656bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69660bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -87,12 +87,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -189,7 +189,7 @@ procedure main() var #1: bv64; var Gamma_#1: bool; lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R2, Gamma_R2 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R2, 20bv64), Gamma_R2; R0, Gamma_R0 := 0bv64, true; @@ -199,10 +199,10 @@ procedure main() call rely(); assert (L(mem, #1) ==> Gamma_R2); mem, Gamma_mem := memory_store32_le(mem, #1, R2[32:0]), gamma_store32(Gamma_mem, #1, Gamma_R2); - assume {:captureState "addr:0x610"}true; + assume {:captureState "%000001c9"} true; call rely(); assert (L(mem, bvadd64(#1, 4bv64)) ==> Gamma_R2); mem, Gamma_mem := memory_store32_le(mem, bvadd64(#1, 4bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(#1, 4bv64), Gamma_R2); - assume {:captureState "addr:0x610"}true; + assume {:captureState "%000001cf"} true; return; } diff --git a/src/test/incorrect/basicassign/gcc_no_plt_no_pic/basicassign.expected b/src/test/incorrect/basicassign/gcc_no_plt_no_pic/basicassign.expected index d3c439a15..2889ce48f 100644 --- a/src/test/incorrect/basicassign/gcc_no_plt_no_pic/basicassign.expected +++ b/src/test/incorrect/basicassign/gcc_no_plt_no_pic/basicassign.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69660bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69660bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -77,7 +77,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -85,12 +85,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -185,7 +185,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 28bv64), Gamma_R0; call rely(); @@ -195,13 +195,13 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%000009dc"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); assert (L(mem, R0) ==> true); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%000009ee"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -211,7 +211,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x74c"}true; + assume {:captureState "%00000a13"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 28bv64), Gamma_R0; call rely(); @@ -221,7 +221,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%00000a38"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -231,7 +231,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x77c"}true; + assume {:captureState "%00000a5d"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/incorrect/basicassign/gcc_pic/basicassign.expected b/src/test/incorrect/basicassign/gcc_pic/basicassign.expected index 2c96223f8..b79b6e403 100644 --- a/src/test/incorrect/basicassign/gcc_pic/basicassign.expected +++ b/src/test/incorrect/basicassign/gcc_pic/basicassign.expected @@ -1,50 +1,50 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69660bv64); -const {:extern }$x_addr: bv64; -axiom {:extern }($x_addr == 69652bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69660bv64); +const {:extern } $x_addr: bv64; +axiom ($x_addr == 69652bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -109,7 +109,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -117,12 +117,12 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive() +procedure {:extern } rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -265,7 +265,7 @@ procedure main() free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -277,14 +277,14 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%00000343"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); call rely(); assert (L(mem, R0) ==> true); mem, Gamma_mem := memory_store32_le(mem, R0, 0bv32), gamma_store32(Gamma_mem, R0, true); - assume {:captureState "addr:0x774"}true; + assume {:captureState "%00000356"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -296,7 +296,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x78c"}true; + assume {:captureState "%0000037d"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -308,7 +308,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x7a4"}true; + assume {:captureState "%000003a4"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -320,7 +320,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x7bc"}true; + assume {:captureState "%000003cb"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/incorrect/basicassign1/clang/basicassign1.expected b/src/test/incorrect/basicassign1/clang/basicassign1.expected index 192f78118..697bdc1da 100644 --- a/src/test/incorrect/basicassign1/clang/basicassign1.expected +++ b/src/test/incorrect/basicassign1/clang/basicassign1.expected @@ -1,46 +1,46 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -189,31 +189,31 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 69632bv64, true; call rely(); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R9[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R9); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002fe"} true; R0, Gamma_R0 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%0000030a"} true; R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R10); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%0000031e"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%0000032d"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); - assume {:captureState "addr:0x744"}true; + assume {:captureState "%0000033c"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/incorrect/basicassign1/clang_O2/basicassign1.expected b/src/test/incorrect/basicassign1/clang_O2/basicassign1.expected index e2752e088..4283ebc9c 100644 --- a/src/test/incorrect/basicassign1/clang_O2/basicassign1.expected +++ b/src/test/incorrect/basicassign1/clang_O2/basicassign1.expected @@ -1,40 +1,40 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,9 +84,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -181,7 +181,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -190,6 +190,6 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000002de"} true; return; } diff --git a/src/test/incorrect/basicassign1/clang_no_plt_no_pic/basicassign1.expected b/src/test/incorrect/basicassign1/clang_no_plt_no_pic/basicassign1.expected index 192f78118..33b46e8d3 100644 --- a/src/test/incorrect/basicassign1/clang_no_plt_no_pic/basicassign1.expected +++ b/src/test/incorrect/basicassign1/clang_no_plt_no_pic/basicassign1.expected @@ -1,46 +1,46 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -189,31 +189,31 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 69632bv64, true; call rely(); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R9[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R9); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000008f8"} true; R0, Gamma_R0 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000904"} true; R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R10[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R10); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%00000918"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x73c"}true; + assume {:captureState "%00000927"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 56bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); - assume {:captureState "addr:0x744"}true; + assume {:captureState "%00000936"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/incorrect/basicassign1/clang_pic/basicassign1.expected b/src/test/incorrect/basicassign1/clang_pic/basicassign1.expected index aa368fb5d..89f18d503 100644 --- a/src/test/incorrect/basicassign1/clang_pic/basicassign1.expected +++ b/src/test/incorrect/basicassign1/clang_pic/basicassign1.expected @@ -1,54 +1,54 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -105,7 +105,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -114,9 +114,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -245,7 +245,7 @@ procedure main() free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 65536bv64, true; call rely(); @@ -253,10 +253,10 @@ procedure main() call rely(); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R9[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R9); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%0000030d"} true; R0, Gamma_R0 := 0bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x76c"}true; + assume {:captureState "%00000319"} true; R10, Gamma_R10 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R9, Gamma_R9 := 65536bv64, true; call rely(); @@ -264,16 +264,16 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R10); mem, Gamma_mem := memory_store32_le(mem, R9, R10[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R10); - assume {:captureState "addr:0x77c"}true; + assume {:captureState "%00000334"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); - assume {:captureState "addr:0x784"}true; + assume {:captureState "%00000343"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store32_le(mem, R9, R8[32:0]), gamma_store32(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x78c"}true; + assume {:captureState "%00000352"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/incorrect/basicassign1/gcc/basicassign1.expected b/src/test/incorrect/basicassign1/gcc/basicassign1.expected index a51ad8781..f1b03dc62 100644 --- a/src/test/incorrect/basicassign1/gcc/basicassign1.expected +++ b/src/test/incorrect/basicassign1/gcc/basicassign1.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,9 +86,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -185,36 +185,36 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%0000031c"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000323"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%0000033d"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000357"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000371"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign1/gcc_O2/basicassign1.expected b/src/test/incorrect/basicassign1/gcc_O2/basicassign1.expected index 6b430f3a3..c6e1dfbe6 100644 --- a/src/test/incorrect/basicassign1/gcc_O2/basicassign1.expected +++ b/src/test/incorrect/basicassign1/gcc_O2/basicassign1.expected @@ -1,40 +1,40 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,9 +84,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -181,7 +181,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; @@ -190,6 +190,6 @@ procedure main() call rely(); assert (L(mem, bvadd64(R1, 20bv64)) ==> Gamma_R2); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R1, 20bv64), R2[32:0]), gamma_store32(Gamma_mem, bvadd64(R1, 20bv64), Gamma_R2); - assume {:captureState "addr:0x610"}true; + assume {:captureState "%000001c5"} true; return; } diff --git a/src/test/incorrect/basicassign1/gcc_no_plt_no_pic/basicassign1.expected b/src/test/incorrect/basicassign1/gcc_no_plt_no_pic/basicassign1.expected index a51ad8781..af62fee01 100644 --- a/src/test/incorrect/basicassign1/gcc_no_plt_no_pic/basicassign1.expected +++ b/src/test/incorrect/basicassign1/gcc_no_plt_no_pic/basicassign1.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,9 +86,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -185,36 +185,36 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%0000095c"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000963"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%0000097d"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000997"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%000009b1"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign1/gcc_pic/basicassign1.expected b/src/test/incorrect/basicassign1/gcc_pic/basicassign1.expected index a2a6827aa..42e0ac655 100644 --- a/src/test/incorrect/basicassign1/gcc_pic/basicassign1.expected +++ b/src/test/incorrect/basicassign1/gcc_pic/basicassign1.expected @@ -1,50 +1,50 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69652bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69652bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,7 +101,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -110,9 +110,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -241,7 +241,7 @@ procedure main() free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -249,9 +249,9 @@ procedure main() call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%0000031d"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%00000324"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -259,14 +259,14 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%0000033f"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x788"}true; + assume {:captureState "%0000035a"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -274,7 +274,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x798"}true; + assume {:captureState "%00000375"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign2/clang/basicassign2.expected b/src/test/incorrect/basicassign2/clang/basicassign2.expected index d35372932..b2abd3337 100644 --- a/src/test/incorrect/basicassign2/clang/basicassign2.expected +++ b/src/test/incorrect/basicassign2/clang/basicassign2.expected @@ -1,47 +1,47 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69696bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69696bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,7 +82,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,9 +91,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -190,30 +190,30 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 69632bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R8, 56bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R9), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R9); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002fe"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), 0bv64), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), true); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000305"} true; R10, Gamma_R10 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 64bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R9, 64bv64), R10), gamma_store64(Gamma_mem, bvadd64(R9, 64bv64), Gamma_R10); - assume {:captureState "addr:0x730"}true; + assume {:captureState "%00000319"} true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 56bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%00000328"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); assert (L(mem, bvadd64(R9, 64bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R9, 64bv64), R8), gamma_store64(Gamma_mem, bvadd64(R9, 64bv64), Gamma_R8); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000337"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign2/clang_O2/basicassign2.expected b/src/test/incorrect/basicassign2/clang_O2/basicassign2.expected index 3e8fe6723..0a90e7afd 100644 --- a/src/test/incorrect/basicassign2/clang_O2/basicassign2.expected +++ b/src/test/incorrect/basicassign2/clang_O2/basicassign2.expected @@ -1,41 +1,41 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69696bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69696bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,9 +85,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -191,6 +191,6 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 64bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R9, 64bv64), R8), gamma_store64(Gamma_mem, bvadd64(R9, 64bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000002de"} true; return; } diff --git a/src/test/incorrect/basicassign2/clang_no_plt_no_pic/basicassign2.expected b/src/test/incorrect/basicassign2/clang_no_plt_no_pic/basicassign2.expected index d35372932..cc84f3c7c 100644 --- a/src/test/incorrect/basicassign2/clang_no_plt_no_pic/basicassign2.expected +++ b/src/test/incorrect/basicassign2/clang_no_plt_no_pic/basicassign2.expected @@ -1,47 +1,47 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69696bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69696bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,7 +82,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,9 +91,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -190,30 +190,30 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 69632bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R8, 56bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R9), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R9); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000008f8"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), 0bv64), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), true); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000008ff"} true; R10, Gamma_R10 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 64bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R9, 64bv64), R10), gamma_store64(Gamma_mem, bvadd64(R9, 64bv64), Gamma_R10); - assume {:captureState "addr:0x730"}true; + assume {:captureState "%00000913"} true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 56bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%00000922"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); assert (L(mem, bvadd64(R9, 64bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R9, 64bv64), R8), gamma_store64(Gamma_mem, bvadd64(R9, 64bv64), Gamma_R8); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000931"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign2/clang_pic/basicassign2.expected b/src/test/incorrect/basicassign2/clang_pic/basicassign2.expected index 308c39d3a..a0c12c266 100644 --- a/src/test/incorrect/basicassign2/clang_pic/basicassign2.expected +++ b/src/test/incorrect/basicassign2/clang_pic/basicassign2.expected @@ -1,47 +1,47 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69688bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69696bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69688bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69696bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,7 +98,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -107,9 +107,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -238,7 +238,7 @@ procedure main() free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 65536bv64, true; call rely(); @@ -246,9 +246,9 @@ procedure main() call rely(); R9, Gamma_R9 := memory_load64_le(mem, R8), (gamma_load64(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R9), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R9); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%0000030d"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), 0bv64), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), true); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%00000314"} true; R10, Gamma_R10 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R9, Gamma_R9 := 65536bv64, true; call rely(); @@ -256,16 +256,16 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R10); mem, Gamma_mem := memory_store64_le(mem, R9, R10), gamma_store64(Gamma_mem, R9, Gamma_R10); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%0000032f"} true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, R8), (gamma_load64(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x780"}true; + assume {:captureState "%0000033e"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store64_le(mem, R9, R8), gamma_store64(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x788"}true; + assume {:captureState "%0000034d"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign2/gcc/basicassign2.expected b/src/test/incorrect/basicassign2/gcc/basicassign2.expected index 296e49fcd..9fec06590 100644 --- a/src/test/incorrect/basicassign2/gcc/basicassign2.expected +++ b/src/test/incorrect/basicassign2/gcc/basicassign2.expected @@ -1,43 +1,43 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69664bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69664bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -78,7 +78,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,9 +87,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -186,36 +186,36 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 32bv64), Gamma_R0; call rely(); R0, Gamma_R0 := memory_load64_le(mem, R0), (gamma_load64(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%0000031c"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), 0bv64), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), true); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000323"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store64_le(mem, R0, R1), gamma_store64(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%0000033d"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 32bv64), Gamma_R0; call rely(); R0, Gamma_R0 := memory_load64_le(mem, R0), (gamma_load64(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000357"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store64_le(mem, R0, R1), gamma_store64(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000371"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign2/gcc_O2/basicassign2.expected b/src/test/incorrect/basicassign2/gcc_O2/basicassign2.expected index b4a8ceb51..3176d2791 100644 --- a/src/test/incorrect/basicassign2/gcc_O2/basicassign2.expected +++ b/src/test/incorrect/basicassign2/gcc_O2/basicassign2.expected @@ -1,41 +1,41 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69664bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69664bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,9 +85,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 24bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; @@ -191,6 +191,6 @@ procedure main() call rely(); assert (L(mem, bvadd64(R1, 24bv64)) ==> Gamma_R2); mem, Gamma_mem := memory_store64_le(mem, bvadd64(R1, 24bv64), R2), gamma_store64(Gamma_mem, bvadd64(R1, 24bv64), Gamma_R2); - assume {:captureState "addr:0x610"}true; + assume {:captureState "%000001c5"} true; return; } diff --git a/src/test/incorrect/basicassign2/gcc_no_plt_no_pic/basicassign2.expected b/src/test/incorrect/basicassign2/gcc_no_plt_no_pic/basicassign2.expected index 296e49fcd..04e29dfc2 100644 --- a/src/test/incorrect/basicassign2/gcc_no_plt_no_pic/basicassign2.expected +++ b/src/test/incorrect/basicassign2/gcc_no_plt_no_pic/basicassign2.expected @@ -1,43 +1,43 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69664bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69664bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -78,7 +78,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,9 +87,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -186,36 +186,36 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 32bv64), Gamma_R0; call rely(); R0, Gamma_R0 := memory_load64_le(mem, R0), (gamma_load64(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%0000095c"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), 0bv64), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), true); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000963"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store64_le(mem, R0, R1), gamma_store64(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%0000097d"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 32bv64), Gamma_R0; call rely(); R0, Gamma_R0 := memory_load64_le(mem, R0), (gamma_load64(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000997"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store64_le(mem, R0, R1), gamma_store64(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%000009b1"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign2/gcc_pic/basicassign2.expected b/src/test/incorrect/basicassign2/gcc_pic/basicassign2.expected index ad2d4daf3..202ea176e 100644 --- a/src/test/incorrect/basicassign2/gcc_pic/basicassign2.expected +++ b/src/test/incorrect/basicassign2/gcc_pic/basicassign2.expected @@ -1,43 +1,43 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69664bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69656bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69664bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69656bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern }rely(); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,9 +103,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -234,7 +234,7 @@ procedure main() free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -242,9 +242,9 @@ procedure main() call rely(); R0, Gamma_R0 := memory_load64_le(mem, R0), (gamma_load64(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%0000031d"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), 0bv64), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), true); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%00000324"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -252,14 +252,14 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store64_le(mem, R0, R1), gamma_store64(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%0000033f"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); call rely(); R0, Gamma_R0 := memory_load64_le(mem, R0), (gamma_load64(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x788"}true; + assume {:captureState "%0000035a"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -267,7 +267,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store64_le(mem, R0, R1), gamma_store64(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x798"}true; + assume {:captureState "%00000375"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign3/clang/basicassign3.expected b/src/test/incorrect/basicassign3/clang/basicassign3.expected index 1f09e5048..49df57e92 100644 --- a/src/test/incorrect/basicassign3/clang/basicassign3.expected +++ b/src/test/incorrect/basicassign3/clang/basicassign3.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69681bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69682bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69681bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69682bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -187,30 +187,30 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 69632bv64, true; call rely(); R9, Gamma_R9 := zero_extend56_8(memory_load8_le(mem, bvadd64(R8, 49bv64))), (gamma_load8(Gamma_mem, bvadd64(R8, 49bv64)) || L(mem, bvadd64(R8, 49bv64))); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R9[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R9); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002fe"} true; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), 0bv8), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), true); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%00000305"} true; R10, Gamma_R10 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 50bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R9, 50bv64), R10[8:0]), gamma_store8(Gamma_mem, bvadd64(R9, 50bv64), Gamma_R10); - assume {:captureState "addr:0x730"}true; + assume {:captureState "%00000319"} true; call rely(); R8, Gamma_R8 := zero_extend56_8(memory_load8_le(mem, bvadd64(R8, 49bv64))), (gamma_load8(Gamma_mem, bvadd64(R8, 49bv64)) || L(mem, bvadd64(R8, 49bv64))); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R8[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R8); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%00000328"} true; R8, Gamma_R8 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); call rely(); assert (L(mem, bvadd64(R9, 50bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R9, 50bv64), R8[8:0]), gamma_store8(Gamma_mem, bvadd64(R9, 50bv64), Gamma_R8); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000337"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign3/clang_O2/basicassign3.expected b/src/test/incorrect/basicassign3/clang_O2/basicassign3.expected index 89a0e981b..b6396a8e4 100644 --- a/src/test/incorrect/basicassign3/clang_O2/basicassign3.expected +++ b/src/test/incorrect/basicassign3/clang_O2/basicassign3.expected @@ -1,38 +1,38 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69684bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69688bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69684bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69688bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,9 +82,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -179,7 +179,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; @@ -188,6 +188,6 @@ procedure main() call rely(); assert (L(mem, bvadd64(R9, 56bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R9, 56bv64), R8[8:0]), gamma_store8(Gamma_mem, bvadd64(R9, 56bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000002de"} true; return; } diff --git a/src/test/incorrect/basicassign3/clang_no_plt_no_pic/basicassign3.expected b/src/test/incorrect/basicassign3/clang_no_plt_no_pic/basicassign3.expected index 1f09e5048..bdad9f7d2 100644 --- a/src/test/incorrect/basicassign3/clang_no_plt_no_pic/basicassign3.expected +++ b/src/test/incorrect/basicassign3/clang_no_plt_no_pic/basicassign3.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69681bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69682bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69681bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69682bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -187,30 +187,30 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 69632bv64, true; call rely(); R9, Gamma_R9 := zero_extend56_8(memory_load8_le(mem, bvadd64(R8, 49bv64))), (gamma_load8(Gamma_mem, bvadd64(R8, 49bv64)) || L(mem, bvadd64(R8, 49bv64))); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R9[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R9); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000008f8"} true; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), 0bv8), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), true); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%000008ff"} true; R10, Gamma_R10 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); R9, Gamma_R9 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R9, 50bv64)) ==> Gamma_R10); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R9, 50bv64), R10[8:0]), gamma_store8(Gamma_mem, bvadd64(R9, 50bv64), Gamma_R10); - assume {:captureState "addr:0x730"}true; + assume {:captureState "%00000913"} true; call rely(); R8, Gamma_R8 := zero_extend56_8(memory_load8_le(mem, bvadd64(R8, 49bv64))), (gamma_load8(Gamma_mem, bvadd64(R8, 49bv64)) || L(mem, bvadd64(R8, 49bv64))); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R8[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R8); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%00000922"} true; R8, Gamma_R8 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); call rely(); assert (L(mem, bvadd64(R9, 50bv64)) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R9, 50bv64), R8[8:0]), gamma_store8(Gamma_mem, bvadd64(R9, 50bv64), Gamma_R8); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000931"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign3/clang_pic/basicassign3.expected b/src/test/incorrect/basicassign3/clang_pic/basicassign3.expected index fde803357..ee84c2efe 100644 --- a/src/test/incorrect/basicassign3/clang_pic/basicassign3.expected +++ b/src/test/incorrect/basicassign3/clang_pic/basicassign3.expected @@ -1,52 +1,52 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R10: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R10: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69681bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69682bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R10: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R10: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69681bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69682bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,7 +103,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -112,9 +112,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -243,7 +243,7 @@ procedure main() free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 65536bv64, true; call rely(); @@ -251,9 +251,9 @@ procedure main() call rely(); R9, Gamma_R9 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R9[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R9); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%0000030d"} true; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), 0bv8), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), true); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%00000314"} true; R10, Gamma_R10 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); R9, Gamma_R9 := 65536bv64, true; call rely(); @@ -261,16 +261,16 @@ procedure main() call rely(); assert (L(mem, R9) ==> Gamma_R10); mem, Gamma_mem := memory_store8_le(mem, R9, R10[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R10); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%0000032f"} true; call rely(); R8, Gamma_R8 := zero_extend56_8(memory_load8_le(mem, R8)), (gamma_load8(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R8[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R8); - assume {:captureState "addr:0x780"}true; + assume {:captureState "%0000033e"} true; R8, Gamma_R8 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); call rely(); assert (L(mem, R9) ==> Gamma_R8); mem, Gamma_mem := memory_store8_le(mem, R9, R8[8:0]), gamma_store8(Gamma_mem, R9, Gamma_R8); - assume {:captureState "addr:0x788"}true; + assume {:captureState "%0000034d"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign3/gcc/basicassign3.expected b/src/test/incorrect/basicassign3/gcc/basicassign3.expected index fcdcec215..fdda84a60 100644 --- a/src/test/incorrect/basicassign3/gcc/basicassign3.expected +++ b/src/test/incorrect/basicassign3/gcc/basicassign3.expected @@ -1,40 +1,40 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69650bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69649bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69650bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69649bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,9 +84,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -183,36 +183,36 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 18bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%0000031c"} true; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), 0bv8), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), true); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000323"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 17bv64), Gamma_R0; R1, Gamma_R1 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%0000033d"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 18bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000357"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 17bv64), Gamma_R0; R1, Gamma_R1 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000371"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign3/gcc_O2/basicassign3.expected b/src/test/incorrect/basicassign3/gcc_O2/basicassign3.expected index 135aac2e1..9dff05b8e 100644 --- a/src/test/incorrect/basicassign3/gcc_O2/basicassign3.expected +++ b/src/test/incorrect/basicassign3/gcc_O2/basicassign3.expected @@ -1,38 +1,38 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R2: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R2: bv64; -var {:extern }mem: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69650bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69649bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R2: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R2: bv64; +var {:extern } mem: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69650bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69649bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,9 +82,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -179,7 +179,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x600"}true; + assume {:captureState "addr:lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 17bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; @@ -188,6 +188,6 @@ procedure main() call rely(); assert (L(mem, bvadd64(R1, 17bv64)) ==> Gamma_R2); mem, Gamma_mem := memory_store8_le(mem, bvadd64(R1, 17bv64), R2[8:0]), gamma_store8(Gamma_mem, bvadd64(R1, 17bv64), Gamma_R2); - assume {:captureState "addr:0x610"}true; + assume {:captureState "%000001c5"} true; return; } diff --git a/src/test/incorrect/basicassign3/gcc_no_plt_no_pic/basicassign3.expected b/src/test/incorrect/basicassign3/gcc_no_plt_no_pic/basicassign3.expected index fcdcec215..acd543640 100644 --- a/src/test/incorrect/basicassign3/gcc_no_plt_no_pic/basicassign3.expected +++ b/src/test/incorrect/basicassign3/gcc_no_plt_no_pic/basicassign3.expected @@ -1,40 +1,40 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69650bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69649bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69650bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69649bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,9 +84,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -183,36 +183,36 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 18bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%0000095c"} true; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), 0bv8), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), true); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000963"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 17bv64), Gamma_R0; R1, Gamma_R1 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x738"}true; + assume {:captureState "%0000097d"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 18bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000997"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 17bv64), Gamma_R0; R1, Gamma_R1 := zero_extend56_8(memory_load8_le(stack, bvadd64(R31, 15bv64))), gamma_load8(Gamma_stack, bvadd64(R31, 15bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%000009b1"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/basicassign3/gcc_pic/basicassign3.expected b/src/test/incorrect/basicassign3/gcc_pic/basicassign3.expected index d9fd7da84..bdda92967 100644 --- a/src/test/incorrect/basicassign3/gcc_pic/basicassign3.expected +++ b/src/test/incorrect/basicassign3/gcc_pic/basicassign3.expected @@ -1,48 +1,48 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -const {:extern }$secret_addr: bv64; -axiom {:extern }($secret_addr == 69650bv64); -const {:extern }$z_addr: bv64; -axiom {:extern }($z_addr == 69649bv64); -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +const {:extern } $secret_addr: bv64; +axiom ($secret_addr == 69650bv64); +const {:extern } $z_addr: bv64; +axiom ($z_addr == 69649bv64); +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern }gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"}zero_extend56_8(bv8) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -99,7 +99,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -108,9 +108,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -239,7 +239,7 @@ procedure main() free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -247,9 +247,9 @@ procedure main() call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%0000031d"} true; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), 0bv8), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), true); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%00000324"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -257,14 +257,14 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x778"}true; + assume {:captureState "%0000033f"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); call rely(); R0, Gamma_R0 := zero_extend56_8(memory_load8_le(mem, R0)), (gamma_load8(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); - assume {:captureState "addr:0x788"}true; + assume {:captureState "%0000035a"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -272,7 +272,7 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store8_le(mem, R0, R1[8:0]), gamma_store8(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x798"}true; + assume {:captureState "%00000375"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/iflocal/clang/iflocal.expected b/src/test/incorrect/iflocal/clang/iflocal.expected index 5c063e7f9..3eb181939 100644 --- a/src/test/incorrect/iflocal/clang/iflocal.expected +++ b/src/test/incorrect/iflocal/clang/iflocal.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -197,15 +197,15 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000002f5"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%000002fd"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%0000030c"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 0bv33))), (Gamma_R8 && Gamma_#4); @@ -231,16 +231,16 @@ procedure main() } goto l00000359; l00000359: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l00000359"} true; goto l0000035a; l0000035a: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l0000035a"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%00000368"} true; goto l00000342; l00000342: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000342"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/iflocal/clang_no_plt_no_pic/iflocal.expected b/src/test/incorrect/iflocal/clang_no_plt_no_pic/iflocal.expected index 5f5666bf5..fd0978448 100644 --- a/src/test/incorrect/iflocal/clang_no_plt_no_pic/iflocal.expected +++ b/src/test/incorrect/iflocal/clang_no_plt_no_pic/iflocal.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -197,15 +197,15 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000917"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%0000091f"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%0000092e"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 0bv33))), (Gamma_R8 && Gamma_#4); @@ -231,16 +231,16 @@ procedure main() } goto l0000097b; l0000097b: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l0000097b"} true; goto l0000097c; l0000097c: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l0000097c"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%0000098a"} true; goto l00000964; l00000964: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000964"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/iflocal/clang_pic/iflocal.expected b/src/test/incorrect/iflocal/clang_pic/iflocal.expected index 5f5666bf5..fd0978448 100644 --- a/src/test/incorrect/iflocal/clang_pic/iflocal.expected +++ b/src/test/incorrect/iflocal/clang_pic/iflocal.expected @@ -1,44 +1,44 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -197,15 +197,15 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000917"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%0000091f"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x724"}true; + assume {:captureState "%0000092e"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 0bv33))), (Gamma_R8 && Gamma_#4); @@ -231,16 +231,16 @@ procedure main() } goto l0000097b; l0000097b: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l0000097b"} true; goto l0000097c; l0000097c: - assume {:captureState "addr:0x73c"}true; + assume {:captureState "addr:l0000097c"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x740"}true; + assume {:captureState "%0000098a"} true; goto l00000964; l00000964: - assume {:captureState "addr:0x748"}true; + assume {:captureState "addr:l00000964"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/iflocal/gcc/iflocal.expected b/src/test/incorrect/iflocal/gcc/iflocal.expected index d43055f8c..77f4caea5 100644 --- a/src/test/incorrect/iflocal/gcc/iflocal.expected +++ b/src/test/incorrect/iflocal/gcc/iflocal.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,9 +86,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -195,13 +195,13 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000002e6"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000002f5"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -214,13 +214,13 @@ procedure main() } goto l0000032d; l0000032d: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l0000032d"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%00000338"} true; goto l00000318; l00000318: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l00000318"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/incorrect/iflocal/gcc_no_plt_no_pic/iflocal.expected b/src/test/incorrect/iflocal/gcc_no_plt_no_pic/iflocal.expected index 689afa450..d3414cf83 100644 --- a/src/test/incorrect/iflocal/gcc_no_plt_no_pic/iflocal.expected +++ b/src/test/incorrect/iflocal/gcc_no_plt_no_pic/iflocal.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,9 +86,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -195,13 +195,13 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000008cd"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000008dc"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -214,13 +214,13 @@ procedure main() } goto l00000914; l00000914: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l00000914"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%0000091f"} true; goto l000008ff; l000008ff: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l000008ff"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/incorrect/iflocal/gcc_pic/iflocal.expected b/src/test/incorrect/iflocal/gcc_pic/iflocal.expected index 689afa450..d3414cf83 100644 --- a/src/test/incorrect/iflocal/gcc_pic/iflocal.expected +++ b/src/test/incorrect/iflocal/gcc_pic/iflocal.expected @@ -1,42 +1,42 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,9 +86,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -195,13 +195,13 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%000008cd"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x720"}true; + assume {:captureState "%000008dc"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -214,13 +214,13 @@ procedure main() } goto l00000914; l00000914: - assume {:captureState "addr:0x730"}true; + assume {:captureState "addr:l00000914"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x734"}true; + assume {:captureState "%0000091f"} true; goto l000008ff; l000008ff: - assume {:captureState "addr:0x738"}true; + assume {:captureState "addr:l000008ff"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/incorrect/nestedifglobal/clang/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/clang/nestedifglobal.expected index 21e0caf09..4077c58eb 100644 --- a/src/test/incorrect/nestedifglobal/clang/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/clang/nestedifglobal.expected @@ -1,50 +1,50 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,7 +85,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,9 +94,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -207,20 +207,20 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000345"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%0000034d"} true; R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000361"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), true); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%00000368"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; @@ -247,16 +247,16 @@ procedure main() } goto l0000045d; l0000045d: - assume {:captureState "addr:0x740"}true; + assume {:captureState "addr:l0000045d"} true; goto l0000045e; l0000045e: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:l0000045e"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%0000046c"} true; goto l0000039e; l0000039e: - assume {:captureState "addr:0x750"}true; + assume {:captureState "addr:l0000039e"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -284,16 +284,16 @@ procedure main() } goto l00000448; l00000448: - assume {:captureState "addr:0x764"}true; + assume {:captureState "addr:l00000448"} true; goto l00000449; l00000449: - assume {:captureState "addr:0x768"}true; + assume {:captureState "addr:l00000449"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x76c"}true; + assume {:captureState "%00000457"} true; goto l000003dc; l000003dc: - assume {:captureState "addr:0x774"}true; + assume {:captureState "addr:l000003dc"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #6, Gamma_#6 := bvadd32(R8[32:0], 4294967292bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934589bv33))), (Gamma_R8 && Gamma_#6); @@ -319,18 +319,18 @@ procedure main() } goto l0000042c; l0000042c: - assume {:captureState "addr:0x784"}true; + assume {:captureState "addr:l0000042c"} true; goto l0000042d; l0000042d: - assume {:captureState "addr:0x788"}true; + assume {:captureState "addr:l0000042d"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x790"}true; + assume {:captureState "%00000442"} true; goto l00000415; l00000415: - assume {:captureState "addr:0x798"}true; + assume {:captureState "addr:l00000415"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/nestedifglobal/clang_no_plt_no_pic/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/clang_no_plt_no_pic/nestedifglobal.expected index caf8a93dd..4ea94364b 100644 --- a/src/test/incorrect/nestedifglobal/clang_no_plt_no_pic/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/clang_no_plt_no_pic/nestedifglobal.expected @@ -1,50 +1,50 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,7 +85,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,9 +94,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -207,20 +207,20 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000a95"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); - assume {:captureState "addr:0x71c"}true; + assume {:captureState "%00000a9d"} true; R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, bvadd64(R8, 52bv64), R9[32:0]), gamma_store32(Gamma_mem, bvadd64(R8, 52bv64), Gamma_R9); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000ab1"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), true); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%00000ab8"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; @@ -247,16 +247,16 @@ procedure main() } goto l00000bad; l00000bad: - assume {:captureState "addr:0x740"}true; + assume {:captureState "addr:l00000bad"} true; goto l00000bae; l00000bae: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:l00000bae"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000bbc"} true; goto l00000aee; l00000aee: - assume {:captureState "addr:0x750"}true; + assume {:captureState "addr:l00000aee"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -284,16 +284,16 @@ procedure main() } goto l00000b98; l00000b98: - assume {:captureState "addr:0x764"}true; + assume {:captureState "addr:l00000b98"} true; goto l00000b99; l00000b99: - assume {:captureState "addr:0x768"}true; + assume {:captureState "addr:l00000b99"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x76c"}true; + assume {:captureState "%00000ba7"} true; goto l00000b2c; l00000b2c: - assume {:captureState "addr:0x774"}true; + assume {:captureState "addr:l00000b2c"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #6, Gamma_#6 := bvadd32(R8[32:0], 4294967292bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934589bv33))), (Gamma_R8 && Gamma_#6); @@ -319,18 +319,18 @@ procedure main() } goto l00000b7c; l00000b7c: - assume {:captureState "addr:0x784"}true; + assume {:captureState "addr:l00000b7c"} true; goto l00000b7d; l00000b7d: - assume {:captureState "addr:0x788"}true; + assume {:captureState "addr:l00000b7d"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); - assume {:captureState "addr:0x790"}true; + assume {:captureState "%00000b92"} true; goto l00000b65; l00000b65: - assume {:captureState "addr:0x798"}true; + assume {:captureState "addr:l00000b65"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/nestedifglobal/clang_pic/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/clang_pic/nestedifglobal.expected index 27a6c476e..7f641b4cb 100644 --- a/src/test/incorrect/nestedifglobal/clang_pic/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/clang_pic/nestedifglobal.expected @@ -1,66 +1,66 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_R8: bool; -var {:extern }Gamma_R9: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R31: bv64; -var {:extern }R8: bv64; -var {:extern }R9: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_R8: bool; +var {:extern } Gamma_R9: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R31: bv64; +var {:extern } R8: bv64; +var {:extern } R9: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern }memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -117,7 +117,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -126,9 +126,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -271,24 +271,24 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4040bv64)) || L(mem, bvadd64(R8, 4040bv64))); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); - assume {:captureState "addr:0x760"}true; + assume {:captureState "%0000035e"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%00000365"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%0000036d"} true; R9, Gamma_R9 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); assert (L(mem, R8) ==> Gamma_R9); mem, Gamma_mem := memory_store32_le(mem, R8, R9[32:0]), gamma_store32(Gamma_mem, R8, Gamma_R9); - assume {:captureState "addr:0x770"}true; + assume {:captureState "%0000037c"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), true); - assume {:captureState "addr:0x774"}true; + assume {:captureState "%00000383"} true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); #4, Gamma_#4 := bvadd32(R8[32:0], 4294967295bv32), Gamma_R8; @@ -315,16 +315,16 @@ procedure main() } goto l00000481; l00000481: - assume {:captureState "addr:0x788"}true; + assume {:captureState "addr:l00000481"} true; goto l00000482; l00000482: - assume {:captureState "addr:0x78c"}true; + assume {:captureState "addr:l00000482"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R8); - assume {:captureState "addr:0x790"}true; + assume {:captureState "%00000490"} true; goto l000003b9; l000003b9: - assume {:captureState "addr:0x798"}true; + assume {:captureState "addr:l000003b9"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -352,16 +352,16 @@ procedure main() } goto l0000046c; l0000046c: - assume {:captureState "addr:0x7ac"}true; + assume {:captureState "addr:l0000046c"} true; goto l0000046d; l0000046d: - assume {:captureState "addr:0x7b0"}true; + assume {:captureState "addr:l0000046d"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R8); - assume {:captureState "addr:0x7b4"}true; + assume {:captureState "%0000047b"} true; goto l000003f9; l000003f9: - assume {:captureState "addr:0x7bc"}true; + assume {:captureState "addr:l000003f9"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); #6, Gamma_#6 := bvadd32(R8[32:0], 4294967292bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934589bv33))), (Gamma_R8 && Gamma_#6); @@ -387,20 +387,20 @@ procedure main() } goto l00000449; l00000449: - assume {:captureState "addr:0x7cc"}true; + assume {:captureState "addr:l00000449"} true; goto l0000044a; l0000044a: - assume {:captureState "addr:0x7d0"}true; + assume {:captureState "addr:l0000044a"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R8); - assume {:captureState "addr:0x7dc"}true; + assume {:captureState "%00000466"} true; goto l00000432; l00000432: - assume {:captureState "addr:0x7e4"}true; + assume {:captureState "addr:l00000432"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/incorrect/nestedifglobal/gcc/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/gcc/nestedifglobal.expected index 0401c2770..b5ba5f23b 100644 --- a/src/test/incorrect/nestedifglobal/gcc/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/gcc/nestedifglobal.expected @@ -1,48 +1,48 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,7 +83,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,9 +92,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -205,19 +205,19 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000332"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%0000034c"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%00000353"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -233,13 +233,13 @@ procedure main() } goto l00000414; l00000414: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:l00000414"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%0000041f"} true; goto l00000381; l00000381: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:l00000381"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -255,13 +255,13 @@ procedure main() } goto l00000407; l00000407: - assume {:captureState "addr:0x760"}true; + assume {:captureState "addr:l00000407"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%00000412"} true; goto l000003b2; l000003b2: - assume {:captureState "addr:0x768"}true; + assume {:captureState "addr:l000003b2"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#6); @@ -274,16 +274,16 @@ procedure main() } goto l000003ed; l000003ed: - assume {:captureState "addr:0x774"}true; + assume {:captureState "addr:l000003ed"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x780"}true; + assume {:captureState "%00000405"} true; goto l000003d8; l000003d8: - assume {:captureState "addr:0x784"}true; + assume {:captureState "addr:l000003d8"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/incorrect/nestedifglobal/gcc_no_plt_no_pic/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/gcc_no_plt_no_pic/nestedifglobal.expected index 234bd851e..8a807f45e 100644 --- a/src/test/incorrect/nestedifglobal/gcc_no_plt_no_pic/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/gcc_no_plt_no_pic/nestedifglobal.expected @@ -1,48 +1,48 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,7 +83,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,9 +92,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -205,19 +205,19 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x714"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x718"}true; + assume {:captureState "%00000a2a"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x728"}true; + assume {:captureState "%00000a44"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); - assume {:captureState "addr:0x72c"}true; + assume {:captureState "%00000a4b"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -233,13 +233,13 @@ procedure main() } goto l00000b0c; l00000b0c: - assume {:captureState "addr:0x744"}true; + assume {:captureState "addr:l00000b0c"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x748"}true; + assume {:captureState "%00000b17"} true; goto l00000a79; l00000a79: - assume {:captureState "addr:0x74c"}true; + assume {:captureState "addr:l00000a79"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -255,13 +255,13 @@ procedure main() } goto l00000aff; l00000aff: - assume {:captureState "addr:0x760"}true; + assume {:captureState "addr:l00000aff"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x764"}true; + assume {:captureState "%00000b0a"} true; goto l00000aaa; l00000aaa: - assume {:captureState "addr:0x768"}true; + assume {:captureState "addr:l00000aaa"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#6); @@ -274,16 +274,16 @@ procedure main() } goto l00000ae5; l00000ae5: - assume {:captureState "addr:0x774"}true; + assume {:captureState "addr:l00000ae5"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x780"}true; + assume {:captureState "%00000afd"} true; goto l00000ad0; l00000ad0: - assume {:captureState "addr:0x784"}true; + assume {:captureState "addr:l00000ad0"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/incorrect/nestedifglobal/gcc_pic/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/gcc_pic/nestedifglobal.expected index 28dd0b805..d81d1a186 100644 --- a/src/test/incorrect/nestedifglobal/gcc_pic/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/gcc_pic/nestedifglobal.expected @@ -1,56 +1,56 @@ -var {:extern }Gamma_R0: bool; -var {:extern }Gamma_R1: bool; -var {:extern }Gamma_R31: bool; -var {:extern }Gamma_mem: [bv64]bool; -var {:extern }Gamma_stack: [bv64]bool; -var {:extern }R0: bv64; -var {:extern }R1: bv64; -var {:extern }R31: bv64; -var {:extern }mem: [bv64]bv8; -var {:extern }stack: [bv64]bv8; -function {:extern }L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern } Gamma_R0: bool; +var {:extern } Gamma_R1: bool; +var {:extern } Gamma_R31: bool; +var {:extern } Gamma_mem: [bv64]bool; +var {:extern } Gamma_stack: [bv64]bool; +var {:extern } R0: bv64; +var {:extern } R1: bv64; +var {:extern } R31: bv64; +var {:extern } mem: [bv64]bv8; +var {:extern } stack: [bv64]bv8; +function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"}bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"}bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"}bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"}bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"}bvnot1(bv1) returns (bv1); -function {:extern }gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern }gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern }gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern }memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern }memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern }memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern }memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"}sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"}zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"}zero_extend32_32(bv32) returns (bv64); -procedure {:extern }rely(); +function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern } rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -107,7 +107,7 @@ procedure {:extern }rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern }rely_transitive() +procedure {:extern } rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -116,9 +116,9 @@ procedure {:extern }rely_transitive() call rely(); } -procedure {:extern }rely_reflexive(); +procedure {:extern } rely_reflexive(); -procedure {:extern }guarantee_reflexive(); +procedure {:extern } guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -261,10 +261,10 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:0x754"}true; + assume {:captureState "addr:lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); - assume {:captureState "addr:0x758"}true; + assume {:captureState "%00000332"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -272,9 +272,9 @@ procedure main() call rely(); assert (L(mem, R0) ==> Gamma_R1); mem, Gamma_mem := memory_store32_le(mem, R0, R1[32:0]), gamma_store32(Gamma_mem, R0, Gamma_R1); - assume {:captureState "addr:0x768"}true; + assume {:captureState "%0000034d"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); - assume {:captureState "addr:0x76c"}true; + assume {:captureState "%00000354"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -291,13 +291,13 @@ procedure main() } goto l00000418; l00000418: - assume {:captureState "addr:0x784"}true; + assume {:captureState "addr:l00000418"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x788"}true; + assume {:captureState "%00000423"} true; goto l00000383; l00000383: - assume {:captureState "addr:0x78c"}true; + assume {:captureState "addr:l00000383"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -314,13 +314,13 @@ procedure main() } goto l0000040b; l0000040b: - assume {:captureState "addr:0x7a0"}true; + assume {:captureState "addr:l0000040b"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x7a4"}true; + assume {:captureState "%00000416"} true; goto l000003b5; l000003b5: - assume {:captureState "addr:0x7a8"}true; + assume {:captureState "addr:l000003b5"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#6); @@ -333,17 +333,17 @@ procedure main() } goto l000003f0; l000003f0: - assume {:captureState "addr:0x7b4"}true; + assume {:captureState "addr:l000003f0"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); - assume {:captureState "addr:0x7c0"}true; + assume {:captureState "%00000409"} true; goto l000003db; l000003db: - assume {:captureState "addr:0x7c4"}true; + assume {:captureState "addr:l000003db"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; From 7e4be9015d3c36fb349ffb64bb96a3c2cd04b1fa Mon Sep 17 00:00:00 2001 From: l-kent Date: Wed, 1 Nov 2023 12:20:45 +1000 Subject: [PATCH 09/11] generalise boogie attributes --- src/main/scala/boogie/BAttribute.scala | 16 ++++++++ src/main/scala/boogie/BCmd.scala | 26 ++----------- src/main/scala/boogie/BExpr.scala | 5 ++- src/main/scala/boogie/BProgram.scala | 19 +++------- src/main/scala/ir/Statement.scala | 41 +++++++++++---------- src/main/scala/translating/BAPToIR.scala | 7 ++-- src/main/scala/translating/IRToBoogie.scala | 21 +++++------ 7 files changed, 66 insertions(+), 69 deletions(-) create mode 100644 src/main/scala/boogie/BAttribute.scala diff --git a/src/main/scala/boogie/BAttribute.scala b/src/main/scala/boogie/BAttribute.scala new file mode 100644 index 000000000..feb1c3243 --- /dev/null +++ b/src/main/scala/boogie/BAttribute.scala @@ -0,0 +1,16 @@ +package boogie + +trait HasAttributes { + def attributes: List[BAttribute] + + val attrString: String = if attributes.nonEmpty then { + attributes.mkString(" ") + " " + } else { + "" + } +} + +case class BAttribute(name: String, value: Option[String] = None) { + private val valueStr = if value.nonEmpty then s" ${value.get}" else "" + override def toString: String = s"{:$name$valueStr}" +} \ No newline at end of file diff --git a/src/main/scala/boogie/BCmd.scala b/src/main/scala/boogie/BCmd.scala index 1144fbfa8..fdd088303 100644 --- a/src/main/scala/boogie/BCmd.scala +++ b/src/main/scala/boogie/BCmd.scala @@ -15,19 +15,11 @@ case class BBlock(label: String, body: List[BCmd]) extends BCmdOrBlock { override def functionOps: Set[FunctionOp] = body.flatMap(c => c.functionOps).toSet override def locals: Set[BVar] = body.flatMap(c => c.locals).toSet override def globals: Set[BVar] = body.flatMap(c => c.globals).toSet - - } -sealed trait BCmd() extends BCmdOrBlock { +sealed trait BCmd() extends BCmdOrBlock with HasAttributes { + override def attributes: List[BAttribute] = List() def comment: Option[String] - def attributes: List[(String, String)] - - val attrString: String = if (attributes.nonEmpty) then { - (attributes.map(a => s"{${a._1} ${a._2}}").mkString(" ")) + " " - } else { - "" - } override def toBoogie: List[String] = { val commentOut = comment.map(" //" + _).getOrElse("") @@ -35,14 +27,14 @@ sealed trait BCmd() extends BCmdOrBlock { } } -case class BAssert(body: BExpr, comment: Option[String] = None, attributes: List[(String, String)] = List.empty) extends BCmd { +case class BAssert(body: BExpr, comment: Option[String] = None, override val attributes: List[BAttribute] = List.empty) extends BCmd { override def toString: String = s"assert $attrString$body;" override def functionOps: Set[FunctionOp] = body.functionOps override def locals: Set[BVar] = body.locals override def globals: Set[BVar] = body.globals } -case class BAssume(body: BExpr, comment: Option[String] = None, attributes: List[(String, String)] = List.empty) extends BCmd { +case class BAssume(body: BExpr, comment: Option[String] = None, override val attributes: List[BAttribute] = List.empty) extends BCmd { override def toString: String = s"assume $attrString$body;" override def functionOps: Set[FunctionOp] = body.functionOps override def locals: Set[BVar] = body.locals @@ -50,8 +42,6 @@ case class BAssume(body: BExpr, comment: Option[String] = None, attributes: List } case class BProcedureCall(name: String, lhss: Seq[BVar], params: Seq[BExpr], comment: Option[String] = None) extends BCmd { - - override def attributes: List[(String, String)] = List.empty override def toString: String = { if (lhss.isEmpty) { s"call $attrString$name();" @@ -65,7 +55,6 @@ case class BProcedureCall(name: String, lhss: Seq[BVar], params: Seq[BExpr], com } case class AssignCmd(lhss: Seq[BVar], rhss: Seq[BExpr], comment: Option[String] = None) extends BCmd { - override def attributes: List[(String, String)] = List.empty override def toString: String = s"${lhss.mkString(", ")} := ${rhss.mkString(", ")};" override def functionOps: Set[FunctionOp] = rhss.flatMap(r => r.functionOps).toSet override def locals: Set[BVar] = lhss.flatMap(l => l.locals).toSet ++ rhss.flatMap(r => r.locals).toSet @@ -77,7 +66,6 @@ object AssignCmd { } case class MapAssignCmd(lhs: MapAccess, rhs: BExpr, comment: Option[String] = None) extends BCmd { - override def attributes: List[(String, String)] = List.empty override def toString: String = s"$lhs := $rhs;" override def functionOps: Set[FunctionOp] = lhs.functionOps ++ rhs.functionOps override def locals: Set[BVar] = lhs.locals ++ rhs.locals @@ -85,7 +73,6 @@ case class MapAssignCmd(lhs: MapAccess, rhs: BExpr, comment: Option[String] = No } case class Havoc(vars: Set[BVar], comment: Option[String] = None) extends BCmd { - override def attributes: List[(String, String)] = List.empty override def toString: String = { if (vars.isEmpty) { "havoc;" @@ -102,7 +89,6 @@ case class IfCmd(guard: BExpr, thenCmds: List[BCmd], comment: Option[String] = N val thenList = thenCmds.flatMap(x => x.toBoogie).map(s => " " + s) List(s"if ($guard) {") ++ thenList ++ List("}") } - override def attributes: List[(String, String)] = List.empty override def toString: String = toBoogie.mkString("\n") override def functionOps: Set[FunctionOp] = guard.functionOps ++ thenCmds.flatMap(c => c.functionOps).toSet override def locals: Set[BVar] = guard.locals ++ thenCmds.flatMap(c => c.locals).toSet @@ -110,19 +96,15 @@ case class IfCmd(guard: BExpr, thenCmds: List[BCmd], comment: Option[String] = N } case class GoToCmd(destination: String, comment: Option[String] = None) extends BCmd { - override def attributes: List[(String, String)] = List.empty override def toString: String = s"goto $destination;" } case object ReturnCmd extends BCmd { - override def attributes: List[(String, String)] = List.empty override def comment: Option[String] = None override def toString: String = "return;" } case class Comment(actualComment: String) extends BCmd { - - override def attributes: List[(String, String)] = List.empty override def comment: Option[String] = Some(actualComment) override def toBoogie: List[String] = List(s"//$actualComment") } diff --git a/src/main/scala/boogie/BExpr.scala b/src/main/scala/boogie/BExpr.scala index 1962ea3b3..804081926 100644 --- a/src/main/scala/boogie/BExpr.scala +++ b/src/main/scala/boogie/BExpr.scala @@ -443,7 +443,10 @@ case class MapUpdate(map: BExpr, index: BExpr, value: BExpr) extends BExpr { sealed trait FunctionOp -case class BVFunctionOp(name: String, bvbuiltin: String, in: List[BVar], out: BVar) extends FunctionOp +case class BVFunctionOp(name: String, bvbuiltin: String, in: List[BVar], out: BVar) extends FunctionOp { + def attribute: BAttribute = BAttribute("bvbuiltin", Some(s"\"$bvbuiltin\"")) +} + case class MemoryLoadOp(addressSize: Int, valueSize: Int, endian: Endian, bits: Int) extends FunctionOp { val accesses: Int = bits / valueSize diff --git a/src/main/scala/boogie/BProgram.scala b/src/main/scala/boogie/BProgram.scala index 01d1db818..1c5974488 100644 --- a/src/main/scala/boogie/BProgram.scala +++ b/src/main/scala/boogie/BProgram.scala @@ -4,15 +4,9 @@ case class BProgram(declarations: List[BDeclaration]) { override def toString: String = declarations.flatMap(x => x.toBoogie).mkString("\n") } -trait BDeclaration() { - def attributes: List[(String, String)] +trait BDeclaration extends HasAttributes { + override def attributes: List[BAttribute] = List() def toBoogie: List[String] = List(toString) - - val attrString: String = if (attributes.nonEmpty) then { - attributes.map(a => s"{${a._1} ${a._2}}").mkString(" ") + " " - } else { - "" - } } case class BProcedure( @@ -27,7 +21,7 @@ case class BProcedure( freeRequires: List[BExpr], modifies: Set[BVar], body: List[BCmdOrBlock], - attributes: List[(String, String)] + override val attributes: List[BAttribute] ) extends BDeclaration() with Ordered[BProcedure] { override def compare(that: BProcedure): Int = name.compare(that.name) @@ -68,12 +62,12 @@ case class BProcedure( def globals: Set[BVar] = body.flatMap(c => c.globals).toSet ++ modifies } -case class BAxiom(body: BExpr, attributes: List[(String, String)]) extends BDeclaration() { +case class BAxiom(body: BExpr, override val attributes: List[BAttribute]) extends BDeclaration() { override def toString: String = s"axiom $attrString$body;" } case class BFunction(name: String, in: List[BVar], out: BVar, body: Option[BExpr], - attributes: List[(String, String)]) + override val attributes: List[BAttribute]) extends BDeclaration() with Ordered[BFunction] { @@ -93,7 +87,7 @@ case class BFunction(name: String, in: List[BVar], out: BVar, body: Option[BExpr } } -case class BVarDecl(variable: BVar, attributes: List[(String, String)]) extends BDeclaration() with Ordered[BVarDecl] { +case class BVarDecl(variable: BVar, override val attributes: List[BAttribute]) extends BDeclaration() with Ordered[BVarDecl] { def compare(that: BVarDecl): Int = variable.compare(that.variable) override def toString: String = if (variable.scope == Scope.Const) { s"const $attrString$variable: ${variable.getType};" @@ -103,7 +97,6 @@ case class BVarDecl(variable: BVar, attributes: List[(String, String)]) extends } case class BConstAxiomPair(const: BVarDecl, axiom: BAxiom) extends BDeclaration() with Ordered[BConstAxiomPair] { - override def attributes: List[(String, String)] = List.empty override def compare(that: BConstAxiomPair): Int = const.compare(that.const) override def toString: String = const.toString + "\n" + axiom.toString } diff --git a/src/main/scala/ir/Statement.scala b/src/main/scala/ir/Statement.scala index 412212605..3eaa12d83 100644 --- a/src/main/scala/ir/Statement.scala +++ b/src/main/scala/ir/Statement.scala @@ -1,6 +1,8 @@ package ir -trait Command +trait Command { + def label: Option[String] +} trait Statement extends Command { def modifies: Set[Global] = Set() @@ -10,7 +12,7 @@ trait Statement extends Command { ) } -class LocalAssign(var lhs: Variable, var rhs: Expr, val label: Option[String] = None) extends Statement { +class LocalAssign(var lhs: Variable, var rhs: Expr, override val label: Option[String] = None) extends Statement { //override def locals: Set[Variable] = rhs.locals + lhs override def modifies: Set[Global] = lhs match { case r: Register => Set(r) @@ -25,7 +27,7 @@ object LocalAssign: def apply(lhs: Variable, rhs: Expr, label: Option[String]) = new LocalAssign(lhs, rhs, label) def unapply(l: LocalAssign) : Option[(Variable, Expr, Option[String])] = Some(l.lhs, l.rhs, l.label) -class MemoryAssign(var lhs: Memory, var rhs: MemoryStore, val label: Option[String] = None) extends Statement { +class MemoryAssign(var lhs: Memory, var rhs: MemoryStore, override val label: Option[String] = None) extends Statement { override def modifies: Set[Global] = Set(lhs) //override def locals: Set[Variable] = rhs.locals override def toString: String = s"$lhs := $rhs" @@ -37,28 +39,29 @@ object MemoryAssign: def unapply(m: MemoryAssign) : Option[(Memory, MemoryStore, Option[String])] = Some(m.lhs, m.rhs, m.label) case object NOP extends Statement { + override def label: Option[String] = None override def toString: String = "" override def acceptVisit(visitor: Visitor): Statement = this } -class Assume(var body: Expr, var comment: Option[String]) extends Statement { +class Assume(var body: Expr, var comment: Option[String], override val label: Option[String] = None) extends Statement { override def toString: String = s"assume $body" + comment.map(" //" + _) override def acceptVisit(visitor: Visitor): Statement = visitor.visitAssume(this) } object Assume: - def apply(body: Expr, comment: Option[String]) = new Assume(body, comment) - def unapply(a: Assume) : Option[(Expr, Option[String])] = Some(a.body, a.comment) + def apply(body: Expr, comment: Option[String], label: Option[String] = None) = new Assume(body, comment, label) + def unapply(a: Assume) : Option[(Expr, Option[String], Option[String])] = Some(a.body, a.comment, a.label) -class Assert(var body: Expr, var comment: Option[String]) extends Statement { +class Assert(var body: Expr, var comment: Option[String], override val label: Option[String] = None) extends Statement { override def toString: String = s"assert $body" + comment.map(" //" + _) override def acceptVisit(visitor: Visitor): Statement = visitor.visitAssert(this) } object Assert: - def apply(body: Expr, comment: Option[String]) : Assert = new Assert(body, comment) - def unapply(a: Assert) : Option[(Expr, Option[String])] = Some(a.body, a.comment) + def apply(body: Expr, comment: Option[String], label: Option[String] = None) : Assert = new Assert(body, comment, label) + def unapply(a: Assert) : Option[(Expr, Option[String], Option[String])] = Some(a.body, a.comment, a.label) trait Jump extends Command { def modifies: Set[Global] = Set() @@ -66,7 +69,7 @@ trait Jump extends Command { def calls: Set[Procedure] = Set() def acceptVisit(visitor: Visitor): Jump = throw new Exception("visitor " + visitor + " unimplemented for: " + this) } -class GoTo(var target: Block, var condition: Option[Expr]) extends Jump { +class GoTo(var target: Block, var condition: Option[Expr], override val label: Option[String] = None) extends Jump { /* override def locals: Set[Variable] = condition match { case Some(c) => c.locals case None => Set() @@ -77,11 +80,11 @@ class GoTo(var target: Block, var condition: Option[Expr]) extends Jump { } object GoTo: - def apply(target: Block, condition: Option[Expr]) = new GoTo(target, condition) + def apply(target: Block, condition: Option[Expr], label: Option[String] = None) = new GoTo(target, condition, label) def unapply(g: GoTo) : Option[(Block, Option[Expr])]= Some(g.target, g.condition) -class DirectCall(var target: Procedure, var condition: Option[Expr], var returnTarget: Option[Block], val address: Option[Int] = None) extends Jump { +class DirectCall(var target: Procedure, var condition: Option[Expr], var returnTarget: Option[Block], override val label: Option[String] = None) extends Jump { /* override def locals: Set[Variable] = condition match { case Some(c) => c.locals case None => Set() @@ -93,14 +96,14 @@ class DirectCall(var target: Procedure, var condition: Option[Expr], var returnT object DirectCall: - def apply(target: Procedure, condition: Option[Expr], returnTarget: Option[Block], address: Option[Int] = None) - = new DirectCall(target, condition, returnTarget, address) + def apply(target: Procedure, condition: Option[Expr], returnTarget: Option[Block], label: Option[String] = None) + = new DirectCall(target, condition, returnTarget, label) - def unapply(i: DirectCall): Option[(Procedure, Option[Expr], Option[Block], Option[Int])] = Some(i.target, i.condition, i.returnTarget, i.address) + def unapply(i: DirectCall): Option[(Procedure, Option[Expr], Option[Block], Option[String])] = Some(i.target, i.condition, i.returnTarget, i.label) class IndirectCall(var target: Variable, var condition: Option[Expr], var returnTarget: Option[Block], - val address: Option[Int] = None) extends Jump { + override val label: Option[String] = None) extends Jump { /* override def locals: Set[Variable] = condition match { case Some(c) => c.locals + target case None => Set(target) @@ -110,7 +113,7 @@ class IndirectCall(var target: Variable, var condition: Option[Expr], var return } object IndirectCall: - def apply(target: Variable, condition: Option[Expr], returnTarget: Option[Block], address: Option[Int] = None) - = new IndirectCall(target, condition, returnTarget, address) + def apply(target: Variable, condition: Option[Expr], returnTarget: Option[Block], label: Option[String] = None) + = new IndirectCall(target, condition, returnTarget, label) - def unapply(i: IndirectCall): Option[(Variable, Option[Expr], Option[Block], Option[Int])] = Some(i.target, i.condition, i.returnTarget, i.address) \ No newline at end of file + def unapply(i: IndirectCall): Option[(Variable, Option[Expr], Option[Block], Option[String])] = Some(i.target, i.condition, i.returnTarget, i.label) \ No newline at end of file diff --git a/src/main/scala/translating/BAPToIR.scala b/src/main/scala/translating/BAPToIR.scala index 73be03222..0243400d1 100644 --- a/src/main/scala/translating/BAPToIR.scala +++ b/src/main/scala/translating/BAPToIR.scala @@ -70,12 +70,13 @@ class BAPToIR(var program: BAPProgram, mainAddress: Int) { DirectCall( nameToProcedure(b.target), coerceToBool(b.condition), - b.returnTarget.map { (t: String) => labelToBlock(t) } + b.returnTarget.map { (t: String) => labelToBlock(t) }, + Some(b.line) ) case b: BAPIndirectCall => - IndirectCall(b.target.toIR, coerceToBool(b.condition), b.returnTarget.map { (t: String) => labelToBlock(t) }) + IndirectCall(b.target.toIR, coerceToBool(b.condition), b.returnTarget.map { (t: String) => labelToBlock(t) }, Some(b.line)) case b: BAPGoTo => - GoTo(labelToBlock(b.target), coerceToBool(b.condition)) + GoTo(labelToBlock(b.target), coerceToBool(b.condition), Some(b.line)) case _ => throw new Exception("unsupported jump: " + j) } diff --git a/src/main/scala/translating/IRToBoogie.scala b/src/main/scala/translating/IRToBoogie.scala index 5b76ebd3e..ff6001397 100644 --- a/src/main/scala/translating/IRToBoogie.scala +++ b/src/main/scala/translating/IRToBoogie.scala @@ -6,7 +6,7 @@ import specification._ import scala.collection.mutable.ArrayBuffer class IRToBoogie(var program: Program, var spec: Specification) { - private val externAttr = (":extern", "") + private val externAttr = BAttribute("extern") private val globals = spec.globals private val controls = spec.controls private val controlled = spec.controlled @@ -96,7 +96,7 @@ class IRToBoogie(var program: Program, var spec: Specification) { def functionOpToDefinition(f: FunctionOp): BFunction = { f match { - case b: BVFunctionOp => BFunction(b.name, b.in, b.out, None, List(externAttr, (":bvbuiltin", s"\"${b.bvbuiltin}\""))) + case b: BVFunctionOp => BFunction(b.name, b.in, b.out, None, List(externAttr, b.attribute)) case m: MemoryLoadOp => val memVar = BMapVar("memory", MapBType(BitVecBType(m.addressSize), BitVecBType(m.valueSize)), Scope.Parameter) val indexVar = BParam("index", BitVecBType(m.addressSize)) @@ -313,17 +313,16 @@ class IRToBoogie(var program: Program, var spec: Specification) { } - def getCaptureStateStatement(stateName: String): BAssume = { - BAssume(TrueBLiteral, None, List((":captureState", s"\"$stateName\""))) + def captureStateStatement(stateName: String): BAssume = { + BAssume(TrueBLiteral, None, List(BAttribute("captureState", Some(s"\"$stateName\"")))) } def translateBlock(b: Block): BBlock = { - val cmds = (b.address match { - case Some(addr) => List(getCaptureStateStatement(s"addr:${b.label}")) - case _ => List.empty - }) ++ (b.statements.flatMap(s => translate(s)) ++ b.jumps.flatMap(j => translate(j))) + val captureState = captureStateStatement(s"${b.label}") + val cmds = List(captureState) + ++ (b.statements.flatMap(s => translate(s)) ++ b.jumps.flatMap(j => translate(j))) - BBlock(b.label, cmds.toList) + BBlock(b.label, cmds) } def translate(j: Jump): List[BCmd] = j match { @@ -379,8 +378,8 @@ class IRToBoogie(var program: Program, var spec: Specification) { val rhsGamma = m.rhs.toGamma val store = AssignCmd(List(lhs, lhsGamma), List(rhs, rhsGamma)) val stateSplit = s match { - case MemoryAssign (_,_, Some(label)) => List(getCaptureStateStatement(s"${label}")) - case LocalAssign(_,_, Some(label)) => List(getCaptureStateStatement(s"${label}")) + case MemoryAssign(_,_, Some(label)) => List(captureStateStatement(s"$label")) + case LocalAssign(_,_, Some(label)) => List(captureStateStatement(s"$label")) case _ => List.empty } if (lhs == stack) { From 2d75e770a5a1a2601954bd607f09d5cb00153e4d Mon Sep 17 00:00:00 2001 From: l-kent Date: Wed, 1 Nov 2023 12:27:52 +1000 Subject: [PATCH 10/11] don't need to define apply for classes in scala 3 unless we want an alternate constructor --- src/main/scala/ir/Statement.scala | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/src/main/scala/ir/Statement.scala b/src/main/scala/ir/Statement.scala index 3eaa12d83..ff614c89e 100644 --- a/src/main/scala/ir/Statement.scala +++ b/src/main/scala/ir/Statement.scala @@ -22,10 +22,8 @@ class LocalAssign(var lhs: Variable, var rhs: Expr, override val label: Option[S override def acceptVisit(visitor: Visitor): Statement = visitor.visitLocalAssign(this) } - object LocalAssign: - def apply(lhs: Variable, rhs: Expr, label: Option[String]) = new LocalAssign(lhs, rhs, label) - def unapply(l: LocalAssign) : Option[(Variable, Expr, Option[String])] = Some(l.lhs, l.rhs, l.label) + def unapply(l: LocalAssign): Option[(Variable, Expr, Option[String])] = Some(l.lhs, l.rhs, l.label) class MemoryAssign(var lhs: Memory, var rhs: MemoryStore, override val label: Option[String] = None) extends Statement { override def modifies: Set[Global] = Set(lhs) @@ -35,8 +33,7 @@ class MemoryAssign(var lhs: Memory, var rhs: MemoryStore, override val label: Op } object MemoryAssign: - def apply(lhs: Memory, rhs: MemoryStore, label: Option[String]) = new MemoryAssign(lhs, rhs, label) - def unapply(m: MemoryAssign) : Option[(Memory, MemoryStore, Option[String])] = Some(m.lhs, m.rhs, m.label) + def unapply(m: MemoryAssign): Option[(Memory, MemoryStore, Option[String])] = Some(m.lhs, m.rhs, m.label) case object NOP extends Statement { override def label: Option[String] = None @@ -50,9 +47,7 @@ class Assume(var body: Expr, var comment: Option[String], override val label: Op } object Assume: - def apply(body: Expr, comment: Option[String], label: Option[String] = None) = new Assume(body, comment, label) - def unapply(a: Assume) : Option[(Expr, Option[String], Option[String])] = Some(a.body, a.comment, a.label) - + def unapply(a: Assume): Option[(Expr, Option[String], Option[String])] = Some(a.body, a.comment, a.label) class Assert(var body: Expr, var comment: Option[String], override val label: Option[String] = None) extends Statement { override def toString: String = s"assert $body" + comment.map(" //" + _) @@ -60,8 +55,7 @@ class Assert(var body: Expr, var comment: Option[String], override val label: Op } object Assert: - def apply(body: Expr, comment: Option[String], label: Option[String] = None) : Assert = new Assert(body, comment, label) - def unapply(a: Assert) : Option[(Expr, Option[String], Option[String])] = Some(a.body, a.comment, a.label) + def unapply(a: Assert): Option[(Expr, Option[String], Option[String])] = Some(a.body, a.comment, a.label) trait Jump extends Command { def modifies: Set[Global] = Set() @@ -80,9 +74,7 @@ class GoTo(var target: Block, var condition: Option[Expr], override val label: O } object GoTo: - def apply(target: Block, condition: Option[Expr], label: Option[String] = None) = new GoTo(target, condition, label) - - def unapply(g: GoTo) : Option[(Block, Option[Expr])]= Some(g.target, g.condition) + def unapply(g: GoTo): Option[(Block, Option[Expr], Option[String])] = Some(g.target, g.condition, g.label) class DirectCall(var target: Procedure, var condition: Option[Expr], var returnTarget: Option[Block], override val label: Option[String] = None) extends Jump { /* override def locals: Set[Variable] = condition match { @@ -94,14 +86,9 @@ class DirectCall(var target: Procedure, var condition: Option[Expr], var returnT override def acceptVisit(visitor: Visitor): Jump = visitor.visitDirectCall(this) } - object DirectCall: - def apply(target: Procedure, condition: Option[Expr], returnTarget: Option[Block], label: Option[String] = None) - = new DirectCall(target, condition, returnTarget, label) - def unapply(i: DirectCall): Option[(Procedure, Option[Expr], Option[Block], Option[String])] = Some(i.target, i.condition, i.returnTarget, i.label) - class IndirectCall(var target: Variable, var condition: Option[Expr], var returnTarget: Option[Block], override val label: Option[String] = None) extends Jump { /* override def locals: Set[Variable] = condition match { @@ -113,7 +100,4 @@ class IndirectCall(var target: Variable, var condition: Option[Expr], var return } object IndirectCall: - def apply(target: Variable, condition: Option[Expr], returnTarget: Option[Block], label: Option[String] = None) - = new IndirectCall(target, condition, returnTarget, label) - def unapply(i: IndirectCall): Option[(Variable, Option[Expr], Option[Block], Option[String])] = Some(i.target, i.condition, i.returnTarget, i.label) \ No newline at end of file From 908e51d2a6f77861e21d3bda0b2d3613b56ec767 Mon Sep 17 00:00:00 2001 From: l-kent Date: Wed, 1 Nov 2023 12:49:11 +1000 Subject: [PATCH 11/11] update expected --- .../clang/arrays_simple.expected | 46 ++--- .../clang_O2/arrays_simple.expected | 22 +- .../arrays_simple.expected | 46 ++--- .../clang_pic/arrays_simple.expected | 46 ++--- .../gcc_O2/arrays_simple.expected | 22 +- .../clang/basic_arrays_read.expected | 48 ++--- .../clang_O2/basic_arrays_read.expected | 36 ++-- .../basic_arrays_read.expected | 48 ++--- .../clang_pic/basic_arrays_read.expected | 52 ++--- .../gcc/basic_arrays_read.expected | 36 ++-- .../gcc_O2/basic_arrays_read.expected | 36 ++-- .../basic_arrays_read.expected | 36 ++-- .../gcc_pic/basic_arrays_read.expected | 40 ++-- .../clang/basic_arrays_write.expected | 52 ++--- .../clang_O2/basic_arrays_write.expected | 42 ++-- .../basic_arrays_write.expected | 52 ++--- .../clang_pic/basic_arrays_write.expected | 56 +++--- .../gcc/basic_arrays_write.expected | 48 ++--- .../gcc_O2/basic_arrays_write.expected | 42 ++-- .../basic_arrays_write.expected | 48 ++--- .../gcc_pic/basic_arrays_write.expected | 52 ++--- .../clang/basic_assign_assign.expected | 40 ++-- .../clang_O2/basic_assign_assign.expected | 40 ++-- .../basic_assign_assign.expected | 40 ++-- .../clang_pic/basic_assign_assign.expected | 44 ++-- .../gcc/basic_assign_assign.expected | 36 ++-- .../gcc_O2/basic_assign_assign.expected | 40 ++-- .../basic_assign_assign.expected | 36 ++-- .../gcc_pic/basic_assign_assign.expected | 40 ++-- .../clang/basic_assign_increment.expected | 46 ++--- .../clang_O2/basic_assign_increment.expected | 46 ++--- .../basic_assign_increment.expected | 46 ++--- .../clang_pic/basic_assign_increment.expected | 50 ++--- .../gcc/basic_assign_increment.expected | 42 ++-- .../gcc_O2/basic_assign_increment.expected | 46 ++--- .../basic_assign_increment.expected | 42 ++-- .../gcc_pic/basic_assign_increment.expected | 46 ++--- .../clang/basic_function_call_caller.expected | 74 +++---- .../basic_function_call_caller.expected | 50 ++--- .../basic_function_call_caller.expected | 74 +++---- .../basic_function_call_caller.expected | 74 +++---- .../gcc/basic_function_call_caller.expected | 70 +++---- .../basic_function_call_caller.expected | 50 ++--- .../basic_function_call_caller.expected | 70 +++---- .../basic_function_call_caller.expected | 70 +++---- .../clang/basic_function_call_reader.expected | 77 +++---- .../basic_function_call_reader.expected | 61 +++--- .../basic_function_call_reader.expected | 77 +++---- .../basic_function_call_reader.expected | 81 ++++---- .../gcc/basic_function_call_reader.expected | 68 +++---- .../basic_function_call_reader.expected | 44 ++-- .../basic_function_call_reader.expected | 68 +++---- .../basic_function_call_reader.expected | 72 +++---- .../clang/basic_lock_read.expected | 75 +++---- .../clang_O2/basic_lock_read.expected | 48 ++--- .../basic_lock_read.expected | 75 +++---- .../clang_pic/basic_lock_read.expected | 79 ++++---- .../gcc/basic_lock_read.expected | 66 +++--- .../gcc_O2/basic_lock_read.expected | 50 ++--- .../basic_lock_read.expected | 66 +++--- .../gcc_pic/basic_lock_read.expected | 70 +++---- .../clang/basic_lock_security_read.expected | 75 +++---- .../basic_lock_security_read.expected | 61 +++--- .../basic_lock_security_read.expected | 75 +++---- .../basic_lock_security_read.expected | 79 ++++---- .../gcc/basic_lock_security_read.expected | 66 +++--- .../gcc_O2/basic_lock_security_read.expected | 50 ++--- .../basic_lock_security_read.expected | 66 +++--- .../gcc_pic/basic_lock_security_read.expected | 70 +++---- .../clang/basic_lock_security_write.expected | 58 +++--- .../basic_lock_security_write.expected | 44 ++-- .../basic_lock_security_write.expected | 58 +++--- .../basic_lock_security_write.expected | 62 +++--- .../gcc/basic_lock_security_write.expected | 50 ++--- .../gcc_O2/basic_lock_security_write.expected | 44 ++-- .../basic_lock_security_write.expected | 50 ++--- .../basic_lock_security_write.expected | 54 ++--- .../clang/basic_lock_unlock.expected | 42 ++-- .../clang_O2/basic_lock_unlock.expected | 46 ++--- .../basic_lock_unlock.expected | 42 ++-- .../clang_pic/basic_lock_unlock.expected | 46 ++--- .../gcc/basic_lock_unlock.expected | 38 ++-- .../gcc_O2/basic_lock_unlock.expected | 46 ++--- .../basic_lock_unlock.expected | 38 ++-- .../gcc_pic/basic_lock_unlock.expected | 42 ++-- .../clang/basic_loop_assign.expected | 44 ++-- .../clang_O2/basic_loop_assign.expected | 44 ++-- .../basic_loop_assign.expected | 44 ++-- .../clang_pic/basic_loop_assign.expected | 48 ++--- .../gcc/basic_loop_assign.expected | 40 ++-- .../gcc_O2/basic_loop_assign.expected | 44 ++-- .../basic_loop_assign.expected | 40 ++-- .../gcc_pic/basic_loop_assign.expected | 44 ++-- .../clang/basic_operation_evaluation.expected | 89 +++++---- .../basic_operation_evaluation.expected | 22 +- .../basic_operation_evaluation.expected | 89 +++++---- .../basic_operation_evaluation.expected | 89 +++++---- .../gcc/basic_operation_evaluation.expected | 73 +++---- .../basic_operation_evaluation.expected | 22 +- .../basic_operation_evaluation.expected | 73 +++---- .../basic_operation_evaluation.expected | 73 +++---- .../clang/basic_sec_policy_read.expected | 75 +++---- .../clang_O2/basic_sec_policy_read.expected | 61 +++--- .../basic_sec_policy_read.expected | 75 +++---- .../clang_pic/basic_sec_policy_read.expected | 79 ++++---- .../gcc/basic_sec_policy_read.expected | 66 +++--- .../gcc_O2/basic_sec_policy_read.expected | 50 ++--- .../basic_sec_policy_read.expected | 66 +++--- .../gcc_pic/basic_sec_policy_read.expected | 70 +++---- .../clang/basic_sec_policy_write.expected | 58 +++--- .../clang_O2/basic_sec_policy_write.expected | 48 ++--- .../basic_sec_policy_write.expected | 58 +++--- .../clang_pic/basic_sec_policy_write.expected | 62 +++--- .../gcc/basic_sec_policy_write.expected | 50 ++--- .../gcc_O2/basic_sec_policy_write.expected | 48 ++--- .../basic_sec_policy_write.expected | 50 ++--- .../gcc_pic/basic_sec_policy_write.expected | 54 ++--- .../clang/basicassign_gamma0.expected | 46 ++--- .../clang_O2/basicassign_gamma0.expected | 46 ++--- .../basicassign_gamma0.expected | 46 ++--- .../clang_pic/basicassign_gamma0.expected | 50 ++--- .../gcc/basicassign_gamma0.expected | 42 ++-- .../gcc_O2/basicassign_gamma0.expected | 46 ++--- .../basicassign_gamma0.expected | 42 ++-- .../gcc_pic/basicassign_gamma0.expected | 46 ++--- .../basicfree/clang/basicfree.expected | 74 +++---- .../basicfree/clang_O2/basicfree.expected | 18 +- .../clang_no_plt_no_pic/basicfree.expected | 74 +++---- .../basicfree/clang_pic/basicfree.expected | 74 +++---- .../correct/basicfree/gcc/basicfree.expected | 70 +++---- .../basicfree/gcc_O2/basicfree.expected | 18 +- .../gcc_no_plt_no_pic/basicfree.expected | 70 +++---- .../basicfree/gcc_pic/basicfree.expected | 70 +++---- src/test/correct/cjump/clang/cjump.expected | 81 ++++---- .../correct/cjump/clang_O2/cjump.expected | 50 ++--- .../cjump/clang_no_plt_no_pic/cjump.expected | 81 ++++---- .../correct/cjump/clang_pic/cjump.expected | 85 ++++---- src/test/correct/cjump/gcc/cjump.expected | 64 +++--- src/test/correct/cjump/gcc_O2/cjump.expected | 46 ++--- .../cjump/gcc_no_plt_no_pic/cjump.expected | 64 +++--- src/test/correct/cjump/gcc_pic/cjump.expected | 68 +++---- .../correct/function/clang/function.expected | 70 +++---- .../function/clang_O2/function.expected | 50 ++--- .../clang_no_plt_no_pic/function.expected | 70 +++---- .../function/clang_pic/function.expected | 70 +++---- .../correct/function/gcc/function.expected | 68 +++---- .../correct/function/gcc_O2/function.expected | 46 ++--- .../gcc_no_plt_no_pic/function.expected | 68 +++---- .../function/gcc_pic/function.expected | 68 +++---- .../function1/clang/function1.expected | 106 +++++----- .../function1/clang_O2/function1.expected | 90 ++++----- .../clang_no_plt_no_pic/function1.expected | 106 +++++----- .../function1/clang_pic/function1.expected | 106 +++++----- .../correct/function1/gcc/function1.expected | 96 ++++----- .../function1/gcc_O2/function1.expected | 82 ++++---- .../gcc_no_plt_no_pic/function1.expected | 96 ++++----- .../function1/gcc_pic/function1.expected | 96 ++++----- .../clang/functions_with_params.expected | 68 +++---- .../clang_O2/functions_with_params.expected | 22 +- .../functions_with_params.expected | 68 +++---- .../clang_pic/functions_with_params.expected | 68 +++---- .../gcc/functions_with_params.expected | 64 +++--- .../gcc_O2/functions_with_params.expected | 22 +- .../functions_with_params.expected | 64 +++--- .../gcc_pic/functions_with_params.expected | 64 +++--- .../ifbranches/clang/ifbranches.expected | 79 ++++---- .../ifbranches/clang_O2/ifbranches.expected | 45 +++-- .../clang_no_plt_no_pic/ifbranches.expected | 79 ++++---- .../ifbranches/clang_pic/ifbranches.expected | 79 ++++---- .../ifbranches/gcc/ifbranches.expected | 70 +++---- .../ifbranches/gcc_O2/ifbranches.expected | 41 ++-- .../gcc_no_plt_no_pic/ifbranches.expected | 70 +++---- .../ifbranches/gcc_pic/ifbranches.expected | 70 +++---- .../correct/ifglobal/clang/ifglobal.expected | 77 +++---- .../ifglobal/clang_O2/ifglobal.expected | 50 ++--- .../clang_no_plt_no_pic/ifglobal.expected | 77 +++---- .../ifglobal/clang_pic/ifglobal.expected | 81 ++++---- .../correct/ifglobal/gcc/ifglobal.expected | 60 +++--- .../correct/ifglobal/gcc_O2/ifglobal.expected | 48 ++--- .../gcc_no_plt_no_pic/ifglobal.expected | 60 +++--- .../ifglobal/gcc_pic/ifglobal.expected | 64 +++--- .../clang_O2/indirect_call.expected | 60 +++--- .../gcc_O2/indirect_call.expected | 62 +++--- .../clang/initialisation.expected | 88 ++++---- .../clang_O2/initialisation.expected | 92 ++++----- .../initialisation.expected | 88 ++++---- .../clang_pic/initialisation.expected | 84 ++++---- .../gcc/initialisation.expected | 64 +++--- .../gcc_O2/initialisation.expected | 84 ++++---- .../gcc_no_plt_no_pic/initialisation.expected | 64 +++--- .../gcc_pic/initialisation.expected | 64 +++--- .../jumptable/clang_O2/jumptable.expected | 48 ++--- .../jumptable/gcc_O2/jumptable.expected | 80 ++++---- .../jumptable3/gcc/jumptable3.expected | 188 +++++++++--------- .../jumptable3/gcc_O2/jumptable3.expected | 110 +++++----- .../gcc_no_plt_no_pic/jumptable3.expected | 188 +++++++++--------- .../jumptable3/gcc_pic/jumptable3.expected | 188 +++++++++--------- .../clang/malloc_with_local.expected | 102 +++++----- .../clang_O2/malloc_with_local.expected | 66 +++--- .../malloc_with_local.expected | 102 +++++----- .../clang_pic/malloc_with_local.expected | 102 +++++----- .../gcc/malloc_with_local.expected | 94 ++++----- .../gcc_O2/malloc_with_local.expected | 70 +++---- .../malloc_with_local.expected | 94 ++++----- .../gcc_pic/malloc_with_local.expected | 94 ++++----- .../clang/malloc_with_local2.expected | 104 +++++----- .../clang_O2/malloc_with_local2.expected | 66 +++--- .../malloc_with_local2.expected | 104 +++++----- .../clang_pic/malloc_with_local2.expected | 104 +++++----- .../gcc/malloc_with_local2.expected | 96 ++++----- .../gcc_O2/malloc_with_local2.expected | 70 +++---- .../malloc_with_local2.expected | 96 ++++----- .../gcc_pic/malloc_with_local2.expected | 96 ++++----- .../clang/malloc_with_local3.expected | 110 +++++----- .../clang_O2/malloc_with_local3.expected | 66 +++--- .../malloc_with_local3.expected | 110 +++++----- .../clang_pic/malloc_with_local3.expected | 110 +++++----- .../gcc/malloc_with_local3.expected | 102 +++++----- .../gcc_O2/malloc_with_local3.expected | 98 ++++----- .../malloc_with_local3.expected | 102 +++++----- .../gcc_pic/malloc_with_local3.expected | 102 +++++----- .../multi_malloc/clang/multi_malloc.expected | 100 +++++----- .../clang_O2/multi_malloc.expected | 64 +++--- .../clang_no_plt_no_pic/multi_malloc.expected | 100 +++++----- .../clang_pic/multi_malloc.expected | 100 +++++----- .../multi_malloc/gcc/multi_malloc.expected | 92 ++++----- .../multi_malloc/gcc_O2/multi_malloc.expected | 68 +++---- .../gcc_no_plt_no_pic/multi_malloc.expected | 92 ++++----- .../gcc_pic/multi_malloc.expected | 92 ++++----- .../correct/nestedif/clang/nestedif.expected | 93 +++++---- .../nestedif/clang_O2/nestedif.expected | 22 +- .../clang_no_plt_no_pic/nestedif.expected | 93 +++++---- .../nestedif/clang_pic/nestedif.expected | 93 +++++---- .../correct/nestedif/gcc/nestedif.expected | 70 +++---- .../correct/nestedif/gcc_O2/nestedif.expected | 22 +- .../gcc_no_plt_no_pic/nestedif.expected | 70 +++---- .../nestedif/gcc_pic/nestedif.expected | 70 +++---- .../clang/no_interference_update_x.expected | 42 ++-- .../no_interference_update_x.expected | 42 ++-- .../no_interference_update_x.expected | 42 ++-- .../no_interference_update_x.expected | 46 ++--- .../gcc/no_interference_update_x.expected | 38 ++-- .../gcc_O2/no_interference_update_x.expected | 42 ++-- .../no_interference_update_x.expected | 38 ++-- .../gcc_pic/no_interference_update_x.expected | 42 ++-- .../clang/no_interference_update_y.expected | 42 ++-- .../no_interference_update_y.expected | 42 ++-- .../no_interference_update_y.expected | 42 ++-- .../no_interference_update_y.expected | 46 ++--- .../gcc/no_interference_update_y.expected | 38 ++-- .../gcc_O2/no_interference_update_y.expected | 42 ++-- .../no_interference_update_y.expected | 38 ++-- .../gcc_pic/no_interference_update_y.expected | 42 ++-- .../secret_write/clang/secret_write.expected | 58 +++--- .../clang_O2/secret_write.expected | 54 ++--- .../clang_no_plt_no_pic/secret_write.expected | 58 +++--- .../clang_pic/secret_write.expected | 62 +++--- .../secret_write/gcc/secret_write.expected | 50 ++--- .../secret_write/gcc_O2/secret_write.expected | 54 ++--- .../gcc_no_plt_no_pic/secret_write.expected | 50 ++--- .../gcc_pic/secret_write.expected | 54 ++--- .../simple_jump/clang/simple_jump.expected | 71 +++---- .../simple_jump/clang_O2/simple_jump.expected | 22 +- .../clang_no_plt_no_pic/simple_jump.expected | 71 +++---- .../clang_pic/simple_jump.expected | 71 +++---- .../simple_jump/gcc/simple_jump.expected | 62 +++--- .../simple_jump/gcc_O2/simple_jump.expected | 22 +- .../gcc_no_plt_no_pic/simple_jump.expected | 62 +++--- .../simple_jump/gcc_pic/simple_jump.expected | 62 +++--- src/test/correct/switch/clang/switch.expected | 78 ++++---- .../correct/switch/clang_O2/switch.expected | 18 +- .../clang_no_plt_no_pic/switch.expected | 78 ++++---- .../correct/switch/clang_pic/switch.expected | 78 ++++---- src/test/correct/switch/gcc/switch.expected | 68 +++---- .../correct/switch/gcc_O2/switch.expected | 18 +- .../switch/gcc_no_plt_no_pic/switch.expected | 68 +++---- .../correct/switch/gcc_pic/switch.expected | 68 +++---- .../correct/switch2/clang_O2/switch2.expected | 18 +- src/test/correct/switch2/gcc/switch2.expected | 112 +++++------ .../correct/switch2/gcc_O2/switch2.expected | 18 +- .../gcc_no_plt_no_pic/switch2.expected | 112 +++++------ .../correct/switch2/gcc_pic/switch2.expected | 112 +++++------ .../correct/syscall/clang/syscall.expected | 72 +++---- .../clang_no_plt_no_pic/syscall.expected | 72 +++---- .../syscall/clang_pic/syscall.expected | 72 +++---- src/test/correct/syscall/gcc/syscall.expected | 72 +++---- .../correct/syscall/gcc_O2/syscall.expected | 24 +-- .../gcc_no_plt_no_pic/syscall.expected | 72 +++---- .../correct/syscall/gcc_pic/syscall.expected | 72 +++---- .../clang/using_gamma_conditional.expected | 77 +++---- .../clang_O2/using_gamma_conditional.expected | 57 +++--- .../using_gamma_conditional.expected | 77 +++---- .../using_gamma_conditional.expected | 81 ++++---- .../gcc/using_gamma_conditional.expected | 56 +++--- .../gcc_O2/using_gamma_conditional.expected | 53 ++--- .../using_gamma_conditional.expected | 56 +++--- .../gcc_pic/using_gamma_conditional.expected | 60 +++--- .../clang/using_gamma_write_z.expected | 44 ++-- .../clang_O2/using_gamma_write_z.expected | 44 ++-- .../using_gamma_write_z.expected | 44 ++-- .../clang_pic/using_gamma_write_z.expected | 48 ++--- .../gcc/using_gamma_write_z.expected | 40 ++-- .../gcc_O2/using_gamma_write_z.expected | 44 ++-- .../using_gamma_write_z.expected | 40 ++-- .../gcc_pic/using_gamma_write_z.expected | 44 ++-- .../basicassign/clang/basicassign.expected | 56 +++--- .../basicassign/clang_O2/basicassign.expected | 52 ++--- .../clang_no_plt_no_pic/basicassign.expected | 56 +++--- .../clang_pic/basicassign.expected | 60 +++--- .../basicassign/gcc/basicassign.expected | 44 ++-- .../basicassign/gcc_O2/basicassign.expected | 48 ++--- .../gcc_no_plt_no_pic/basicassign.expected | 44 ++-- .../basicassign/gcc_pic/basicassign.expected | 48 ++--- .../basicassign1/clang/basicassign1.expected | 56 +++--- .../clang_O2/basicassign1.expected | 44 ++-- .../clang_no_plt_no_pic/basicassign1.expected | 56 +++--- .../clang_pic/basicassign1.expected | 60 +++--- .../basicassign1/gcc/basicassign1.expected | 48 ++--- .../basicassign1/gcc_O2/basicassign1.expected | 44 ++-- .../gcc_no_plt_no_pic/basicassign1.expected | 48 ++--- .../gcc_pic/basicassign1.expected | 52 ++--- .../basicassign2/clang/basicassign2.expected | 56 +++--- .../clang_O2/basicassign2.expected | 44 ++-- .../clang_no_plt_no_pic/basicassign2.expected | 56 +++--- .../clang_pic/basicassign2.expected | 56 +++--- .../basicassign2/gcc/basicassign2.expected | 48 ++--- .../basicassign2/gcc_O2/basicassign2.expected | 44 ++-- .../gcc_no_plt_no_pic/basicassign2.expected | 48 ++--- .../gcc_pic/basicassign2.expected | 48 ++--- .../basicassign3/clang/basicassign3.expected | 56 +++--- .../clang_O2/basicassign3.expected | 44 ++-- .../clang_no_plt_no_pic/basicassign3.expected | 56 +++--- .../clang_pic/basicassign3.expected | 60 +++--- .../basicassign3/gcc/basicassign3.expected | 48 ++--- .../basicassign3/gcc_O2/basicassign3.expected | 44 ++-- .../gcc_no_plt_no_pic/basicassign3.expected | 48 ++--- .../gcc_pic/basicassign3.expected | 52 ++--- .../incorrect/iflocal/clang/iflocal.expected | 69 ++++--- .../clang_no_plt_no_pic/iflocal.expected | 69 ++++--- .../iflocal/clang_pic/iflocal.expected | 69 ++++--- .../incorrect/iflocal/gcc/iflocal.expected | 60 +++--- .../gcc_no_plt_no_pic/iflocal.expected | 60 +++--- .../iflocal/gcc_pic/iflocal.expected | 60 +++--- .../clang/nestedifglobal.expected | 93 +++++---- .../nestedifglobal.expected | 93 +++++---- .../clang_pic/nestedifglobal.expected | 101 +++++----- .../gcc/nestedifglobal.expected | 74 +++---- .../gcc_no_plt_no_pic/nestedifglobal.expected | 74 +++---- .../gcc_pic/nestedifglobal.expected | 78 ++++---- 349 files changed, 10993 insertions(+), 10792 deletions(-) diff --git a/src/test/correct/arrays_simple/clang/arrays_simple.expected b/src/test/correct/arrays_simple/clang/arrays_simple.expected index cdbb1ceb9..ca54b2d0a 100644 --- a/src/test/correct/arrays_simple/clang/arrays_simple.expected +++ b/src/test/correct/arrays_simple/clang/arrays_simple.expected @@ -1,38 +1,38 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1872bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,9 +82,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -181,7 +181,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R8); diff --git a/src/test/correct/arrays_simple/clang_O2/arrays_simple.expected b/src/test/correct/arrays_simple/clang_O2/arrays_simple.expected index dfc8a4e7d..b904c03a5 100644 --- a/src/test/correct/arrays_simple/clang_O2/arrays_simple.expected +++ b/src/test/correct/arrays_simple/clang_O2/arrays_simple.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1840bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/arrays_simple/clang_no_plt_no_pic/arrays_simple.expected b/src/test/correct/arrays_simple/clang_no_plt_no_pic/arrays_simple.expected index cdbb1ceb9..ca54b2d0a 100644 --- a/src/test/correct/arrays_simple/clang_no_plt_no_pic/arrays_simple.expected +++ b/src/test/correct/arrays_simple/clang_no_plt_no_pic/arrays_simple.expected @@ -1,38 +1,38 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1872bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,9 +82,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -181,7 +181,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R8); diff --git a/src/test/correct/arrays_simple/clang_pic/arrays_simple.expected b/src/test/correct/arrays_simple/clang_pic/arrays_simple.expected index cdbb1ceb9..ca54b2d0a 100644 --- a/src/test/correct/arrays_simple/clang_pic/arrays_simple.expected +++ b/src/test/correct/arrays_simple/clang_pic/arrays_simple.expected @@ -1,38 +1,38 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1872bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,9 +82,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -181,7 +181,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R8); diff --git a/src/test/correct/arrays_simple/gcc_O2/arrays_simple.expected b/src/test/correct/arrays_simple/gcc_O2/arrays_simple.expected index db578d839..306991d20 100644 --- a/src/test/correct/arrays_simple/gcc_O2/arrays_simple.expected +++ b/src/test/correct/arrays_simple/gcc_O2/arrays_simple.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1896bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_arrays_read/clang/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/clang/basic_arrays_read.expected index 51a10f3b8..4bdf41446 100644 --- a/src/test/correct/basic_arrays_read/clang/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/clang/basic_arrays_read.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $arr_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $arr_addr: bv64; axiom ($arr_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -85,12 +85,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert true; @@ -190,7 +190,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000002d1"} true; diff --git a/src/test/correct/basic_arrays_read/clang_O2/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/clang_O2/basic_arrays_read.expected index efc782dbb..053a779de 100644 --- a/src/test/correct/basic_arrays_read/clang_O2/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/clang_O2/basic_arrays_read.expected @@ -1,33 +1,33 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $arr_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $arr_addr: bv64; axiom ($arr_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -68,7 +68,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -76,12 +76,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert true; @@ -179,7 +179,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); diff --git a/src/test/correct/basic_arrays_read/clang_no_plt_no_pic/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/clang_no_plt_no_pic/basic_arrays_read.expected index 9677616ad..8fa9643f0 100644 --- a/src/test/correct/basic_arrays_read/clang_no_plt_no_pic/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/clang_no_plt_no_pic/basic_arrays_read.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $arr_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $arr_addr: bv64; axiom ($arr_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -85,12 +85,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert true; @@ -190,7 +190,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000863"} true; diff --git a/src/test/correct/basic_arrays_read/clang_pic/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/clang_pic/basic_arrays_read.expected index 119db2945..fe469ac3d 100644 --- a/src/test/correct/basic_arrays_read/clang_pic/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/clang_pic/basic_arrays_read.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $arr_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $arr_addr: bv64; axiom ($arr_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -93,7 +93,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -101,12 +101,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert true; @@ -222,7 +222,7 @@ procedure main() free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000002d5"} true; diff --git a/src/test/correct/basic_arrays_read/gcc/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/gcc/basic_arrays_read.expected index aa2899d20..39f86e8f0 100644 --- a/src/test/correct/basic_arrays_read/gcc/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/gcc/basic_arrays_read.expected @@ -1,36 +1,36 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $arr_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $arr_addr: bv64; axiom ($arr_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -71,7 +71,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -79,12 +79,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert true; @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); diff --git a/src/test/correct/basic_arrays_read/gcc_O2/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/gcc_O2/basic_arrays_read.expected index 8b51616b4..897f29d0a 100644 --- a/src/test/correct/basic_arrays_read/gcc_O2/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/gcc_O2/basic_arrays_read.expected @@ -1,33 +1,33 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $arr_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $arr_addr: bv64; axiom ($arr_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -68,7 +68,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -76,12 +76,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert true; @@ -179,7 +179,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); diff --git a/src/test/correct/basic_arrays_read/gcc_no_plt_no_pic/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/gcc_no_plt_no_pic/basic_arrays_read.expected index e14123c99..fe51c2369 100644 --- a/src/test/correct/basic_arrays_read/gcc_no_plt_no_pic/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/gcc_no_plt_no_pic/basic_arrays_read.expected @@ -1,36 +1,36 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $arr_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $arr_addr: bv64; axiom ($arr_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -71,7 +71,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -79,12 +79,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert true; @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); diff --git a/src/test/correct/basic_arrays_read/gcc_pic/basic_arrays_read.expected b/src/test/correct/basic_arrays_read/gcc_pic/basic_arrays_read.expected index 4ce3ddd81..b8d3ae1b0 100644 --- a/src/test/correct/basic_arrays_read/gcc_pic/basic_arrays_read.expected +++ b/src/test/correct/basic_arrays_read/gcc_pic/basic_arrays_read.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $arr_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $arr_addr: bv64; axiom ($arr_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, bvadd64($arr_addr, 0bv64))) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); { @@ -95,12 +95,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert true; @@ -214,7 +214,7 @@ procedure main() free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4080bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4080bv64)) || L(mem, bvadd64(R0, 4080bv64))); diff --git a/src/test/correct/basic_arrays_write/clang/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/clang/basic_arrays_write.expected index fa1ca5a2b..802dd2fd8 100644 --- a/src/test/correct/basic_arrays_write/clang/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/clang/basic_arrays_write.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $arr_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $arr_addr: bv64; axiom ($arr_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -87,12 +87,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert true; } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -194,7 +194,7 @@ procedure main() { var arr$0_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R9, Gamma_R9 := 69632bv64, true; R9, Gamma_R9 := bvadd64(R9, 52bv64), Gamma_R9; diff --git a/src/test/correct/basic_arrays_write/clang_O2/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/clang_O2/basic_arrays_write.expected index e22e851bb..0b0f67500 100644 --- a/src/test/correct/basic_arrays_write/clang_O2/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/clang_O2/basic_arrays_write.expected @@ -1,36 +1,36 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $arr_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $arr_addr: bv64; axiom ($arr_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -71,7 +71,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -79,12 +79,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert true; } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -184,7 +184,7 @@ procedure main() { var arr$0_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/basic_arrays_write/clang_no_plt_no_pic/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/clang_no_plt_no_pic/basic_arrays_write.expected index 6f9a27b7f..451345fbe 100644 --- a/src/test/correct/basic_arrays_write/clang_no_plt_no_pic/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/clang_no_plt_no_pic/basic_arrays_write.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $arr_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $arr_addr: bv64; axiom ($arr_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -87,12 +87,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert true; } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -194,7 +194,7 @@ procedure main() { var arr$0_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R9, Gamma_R9 := 69632bv64, true; R9, Gamma_R9 := bvadd64(R9, 52bv64), Gamma_R9; diff --git a/src/test/correct/basic_arrays_write/clang_pic/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/clang_pic/basic_arrays_write.expected index 5f24ac94c..d97347e01 100644 --- a/src/test/correct/basic_arrays_write/clang_pic/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/clang_pic/basic_arrays_write.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $arr_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $arr_addr: bv64; axiom ($arr_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -95,7 +95,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -103,12 +103,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert true; } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -226,7 +226,7 @@ procedure main() { var arr$0_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R9, Gamma_R9 := 65536bv64, true; call rely(); diff --git a/src/test/correct/basic_arrays_write/gcc/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/gcc/basic_arrays_write.expected index 842329e9c..633928146 100644 --- a/src/test/correct/basic_arrays_write/gcc/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/gcc/basic_arrays_write.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $arr_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $arr_addr: bv64; axiom ($arr_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -85,12 +85,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert true; } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -192,7 +192,7 @@ procedure main() { var arr$0_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000002da"} true; diff --git a/src/test/correct/basic_arrays_write/gcc_O2/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/gcc_O2/basic_arrays_write.expected index 1d10bd0a8..72ddd2b51 100644 --- a/src/test/correct/basic_arrays_write/gcc_O2/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/gcc_O2/basic_arrays_write.expected @@ -1,36 +1,36 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $arr_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $arr_addr: bv64; axiom ($arr_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -71,7 +71,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -79,12 +79,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert true; } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -184,7 +184,7 @@ procedure main() { var arr$0_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/basic_arrays_write/gcc_no_plt_no_pic/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/gcc_no_plt_no_pic/basic_arrays_write.expected index dfc86a463..acde06d29 100644 --- a/src/test/correct/basic_arrays_write/gcc_no_plt_no_pic/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/gcc_no_plt_no_pic/basic_arrays_write.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $arr_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $arr_addr: bv64; axiom ($arr_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -85,12 +85,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert true; } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -192,7 +192,7 @@ procedure main() { var arr$0_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000885"} true; diff --git a/src/test/correct/basic_arrays_write/gcc_pic/basic_arrays_write.expected b/src/test/correct/basic_arrays_write/gcc_pic/basic_arrays_write.expected index f0df48118..f49966fbc 100644 --- a/src/test/correct/basic_arrays_write/gcc_pic/basic_arrays_write.expected +++ b/src/test/correct/basic_arrays_write/gcc_pic/basic_arrays_write.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $arr_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $arr_addr: bv64; axiom ($arr_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures true; @@ -93,7 +93,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures true; { @@ -101,12 +101,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert true; } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64))); @@ -224,7 +224,7 @@ procedure main() { var arr$0_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000002da"} true; diff --git a/src/test/correct/basic_assign_assign/clang/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/clang/basic_assign_assign.expected index 9c8f8e054..45d3ed040 100644 --- a/src/test/correct/basic_assign_assign/clang/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/clang/basic_assign_assign.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -78,12 +78,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -184,7 +184,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 5bv64, true; call rely(); diff --git a/src/test/correct/basic_assign_assign/clang_O2/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/clang_O2/basic_assign_assign.expected index e95a25ce5..00e811d26 100644 --- a/src/test/correct/basic_assign_assign/clang_O2/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/clang_O2/basic_assign_assign.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -78,12 +78,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -184,7 +184,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 5bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/basic_assign_assign/clang_no_plt_no_pic/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/clang_no_plt_no_pic/basic_assign_assign.expected index b64e6256d..1d38b377b 100644 --- a/src/test/correct/basic_assign_assign/clang_no_plt_no_pic/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/clang_no_plt_no_pic/basic_assign_assign.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -78,12 +78,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -184,7 +184,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 5bv64, true; call rely(); diff --git a/src/test/correct/basic_assign_assign/clang_pic/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/clang_pic/basic_assign_assign.expected index 9adc4bc36..17aef59a5 100644 --- a/src/test/correct/basic_assign_assign/clang_pic/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/clang_pic/basic_assign_assign.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -86,7 +86,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -94,12 +94,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -216,7 +216,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); diff --git a/src/test/correct/basic_assign_assign/gcc/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/gcc/basic_assign_assign.expected index 38fd4e9ff..238102d1a 100644 --- a/src/test/correct/basic_assign_assign/gcc/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/gcc/basic_assign_assign.expected @@ -1,33 +1,33 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -68,7 +68,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -76,12 +76,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -182,7 +182,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 5bv64, true; diff --git a/src/test/correct/basic_assign_assign/gcc_O2/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/gcc_O2/basic_assign_assign.expected index 55dc84373..81d8fdece 100644 --- a/src/test/correct/basic_assign_assign/gcc_O2/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/gcc_O2/basic_assign_assign.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -78,12 +78,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -184,7 +184,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 5bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/basic_assign_assign/gcc_no_plt_no_pic/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/gcc_no_plt_no_pic/basic_assign_assign.expected index 60efa0cb5..1b1ef4f87 100644 --- a/src/test/correct/basic_assign_assign/gcc_no_plt_no_pic/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/gcc_no_plt_no_pic/basic_assign_assign.expected @@ -1,33 +1,33 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -68,7 +68,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -76,12 +76,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -182,7 +182,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 5bv64, true; diff --git a/src/test/correct/basic_assign_assign/gcc_pic/basic_assign_assign.expected b/src/test/correct/basic_assign_assign/gcc_pic/basic_assign_assign.expected index 2e59e747e..ffd291153 100644 --- a/src/test/correct/basic_assign_assign/gcc_pic/basic_assign_assign.expected +++ b/src/test/correct/basic_assign_assign/gcc_pic/basic_assign_assign.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -84,7 +84,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); { @@ -92,12 +92,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -214,7 +214,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); diff --git a/src/test/correct/basic_assign_increment/clang/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/clang/basic_assign_increment.expected index aad1b3b63..528931a0f 100644 --- a/src/test/correct/basic_assign_increment/clang/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/clang/basic_assign_increment.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -84,12 +84,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -190,7 +190,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R9, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R9, 52bv64)) || L(mem, bvadd64(R9, 52bv64))); diff --git a/src/test/correct/basic_assign_increment/clang_O2/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/clang_O2/basic_assign_increment.expected index f1e4916f6..68697865d 100644 --- a/src/test/correct/basic_assign_increment/clang_O2/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/clang_O2/basic_assign_increment.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -84,12 +84,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -190,7 +190,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); diff --git a/src/test/correct/basic_assign_increment/clang_no_plt_no_pic/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/clang_no_plt_no_pic/basic_assign_increment.expected index 5b8b8cf93..fcde38982 100644 --- a/src/test/correct/basic_assign_increment/clang_no_plt_no_pic/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/clang_no_plt_no_pic/basic_assign_increment.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -84,12 +84,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -190,7 +190,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R9, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R9, 52bv64)) || L(mem, bvadd64(R9, 52bv64))); diff --git a/src/test/correct/basic_assign_increment/clang_pic/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/clang_pic/basic_assign_increment.expected index c37e6ca48..86e9d68ec 100644 --- a/src/test/correct/basic_assign_increment/clang_pic/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/clang_pic/basic_assign_increment.expected @@ -1,49 +1,49 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -92,7 +92,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -100,12 +100,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -222,7 +222,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); diff --git a/src/test/correct/basic_assign_increment/gcc/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/gcc/basic_assign_increment.expected index c5b62995a..1c13cd862 100644 --- a/src/test/correct/basic_assign_increment/gcc/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/gcc/basic_assign_increment.expected @@ -1,39 +1,39 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -74,7 +74,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -82,12 +82,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -188,7 +188,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); diff --git a/src/test/correct/basic_assign_increment/gcc_O2/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/gcc_O2/basic_assign_increment.expected index 7ae4e3385..07a2894d0 100644 --- a/src/test/correct/basic_assign_increment/gcc_O2/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/gcc_O2/basic_assign_increment.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -84,12 +84,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -190,7 +190,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R2, Gamma_R2 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); diff --git a/src/test/correct/basic_assign_increment/gcc_no_plt_no_pic/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/gcc_no_plt_no_pic/basic_assign_increment.expected index 56bb581a8..01ec2e5fb 100644 --- a/src/test/correct/basic_assign_increment/gcc_no_plt_no_pic/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/gcc_no_plt_no_pic/basic_assign_increment.expected @@ -1,39 +1,39 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -74,7 +74,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -82,12 +82,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -188,7 +188,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); diff --git a/src/test/correct/basic_assign_increment/gcc_pic/basic_assign_increment.expected b/src/test/correct/basic_assign_increment/gcc_pic/basic_assign_increment.expected index 1b021ed21..0f73e2bfe 100644 --- a/src/test/correct/basic_assign_increment/gcc_pic/basic_assign_increment.expected +++ b/src/test/correct/basic_assign_increment/gcc_pic/basic_assign_increment.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); @@ -90,7 +90,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (memory_load32_le(mem, $x_addr) == 5bv32)); { @@ -98,12 +98,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 5bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (memory_load32_le(mem, $x_addr) == 1bv32)) || (memory_load32_le(mem, $x_addr) == 6bv32)); @@ -220,7 +220,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); diff --git a/src/test/correct/basic_function_call_caller/clang/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/clang/basic_function_call_caller.expected index c07d90bb6..6c8610d8c 100644 --- a/src/test/correct/basic_function_call_caller/clang/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/clang/basic_function_call_caller.expected @@ -1,66 +1,66 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -102,7 +102,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -111,13 +111,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -227,7 +227,7 @@ procedure main() var Gamma_y_old: bool; var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -241,7 +241,7 @@ procedure main() call zero(); goto l00000321; l00000321: - assume {:captureState "addr:l00000321"} true; + assume {:captureState "l00000321"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R0); @@ -348,7 +348,7 @@ procedure zero() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lzero: - assume {:captureState "addr:lzero"} true; + assume {:captureState "lzero"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_caller/clang_O2/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/clang_O2/basic_function_call_caller.expected index 092049e86..74d7abc58 100644 --- a/src/test/correct/basic_function_call_caller/clang_O2/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/clang_O2/basic_function_call_caller.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -80,7 +80,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -89,13 +89,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -197,7 +197,7 @@ procedure main() var Gamma_y_old: bool; var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 0bv64, true; R9, Gamma_R9 := 69632bv64, true; diff --git a/src/test/correct/basic_function_call_caller/clang_no_plt_no_pic/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/clang_no_plt_no_pic/basic_function_call_caller.expected index 22ee5ada7..04a6a5d25 100644 --- a/src/test/correct/basic_function_call_caller/clang_no_plt_no_pic/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/clang_no_plt_no_pic/basic_function_call_caller.expected @@ -1,66 +1,66 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -102,7 +102,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -111,13 +111,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -227,7 +227,7 @@ procedure main() var Gamma_y_old: bool; var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -241,7 +241,7 @@ procedure main() call zero(); goto l00000938; l00000938: - assume {:captureState "addr:l00000938"} true; + assume {:captureState "l00000938"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R0); @@ -348,7 +348,7 @@ procedure zero() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lzero: - assume {:captureState "addr:lzero"} true; + assume {:captureState "lzero"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_caller/clang_pic/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/clang_pic/basic_function_call_caller.expected index 4b7a73526..861158d4a 100644 --- a/src/test/correct/basic_function_call_caller/clang_pic/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/clang_pic/basic_function_call_caller.expected @@ -1,66 +1,66 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -118,7 +118,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -127,13 +127,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -275,7 +275,7 @@ procedure main() var Gamma_y_old: bool; var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -289,7 +289,7 @@ procedure main() call zero(); goto l00000329; l00000329: - assume {:captureState "addr:l00000329"} true; + assume {:captureState "l00000329"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -432,7 +432,7 @@ procedure zero() free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { lzero: - assume {:captureState "addr:lzero"} true; + assume {:captureState "lzero"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_caller/gcc/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/gcc/basic_function_call_caller.expected index ffb17ca5f..d350182f1 100644 --- a/src/test/correct/basic_function_call_caller/gcc/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/gcc/basic_function_call_caller.expected @@ -1,64 +1,64 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -100,7 +100,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -109,13 +109,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -223,7 +223,7 @@ procedure main() var Gamma_y_old: bool; var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000302"} true; @@ -237,7 +237,7 @@ procedure main() call zero(); goto l00000323; l00000323: - assume {:captureState "addr:l00000323"} true; + assume {:captureState "l00000323"} true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; @@ -346,7 +346,7 @@ procedure zero() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lzero: - assume {:captureState "addr:lzero"} true; + assume {:captureState "lzero"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_caller/gcc_O2/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/gcc_O2/basic_function_call_caller.expected index b7a8e4c30..0d135f9f8 100644 --- a/src/test/correct/basic_function_call_caller/gcc_O2/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/gcc_O2/basic_function_call_caller.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R3: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R3: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R3: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} R3: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -80,7 +80,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -89,13 +89,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -197,7 +197,7 @@ procedure main() var Gamma_y_old: bool; var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R3, Gamma_R3 := zero_extend32_32(R0[32:0]), Gamma_R0; diff --git a/src/test/correct/basic_function_call_caller/gcc_no_plt_no_pic/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/gcc_no_plt_no_pic/basic_function_call_caller.expected index 9549d6dff..39a811b3e 100644 --- a/src/test/correct/basic_function_call_caller/gcc_no_plt_no_pic/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/gcc_no_plt_no_pic/basic_function_call_caller.expected @@ -1,64 +1,64 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -100,7 +100,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -109,13 +109,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -223,7 +223,7 @@ procedure main() var Gamma_y_old: bool; var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000929"} true; @@ -237,7 +237,7 @@ procedure main() call zero(); goto l0000094a; l0000094a: - assume {:captureState "addr:l0000094a"} true; + assume {:captureState "l0000094a"} true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; @@ -346,7 +346,7 @@ procedure zero() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lzero: - assume {:captureState "addr:lzero"} true; + assume {:captureState "lzero"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_caller/gcc_pic/basic_function_call_caller.expected b/src/test/correct/basic_function_call_caller/gcc_pic/basic_function_call_caller.expected index 914d32dd1..75e7e00b2 100644 --- a/src/test/correct/basic_function_call_caller/gcc_pic/basic_function_call_caller.expected +++ b/src/test/correct/basic_function_call_caller/gcc_pic/basic_function_call_caller.expected @@ -1,64 +1,64 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -116,7 +116,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -125,13 +125,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -271,7 +271,7 @@ procedure main() var Gamma_y_old: bool; var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000302"} true; @@ -285,7 +285,7 @@ procedure main() call zero(); goto l00000323; l00000323: - assume {:captureState "addr:l00000323"} true; + assume {:captureState "l00000323"} true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -428,7 +428,7 @@ procedure zero() free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { lzero: - assume {:captureState "addr:lzero"} true; + assume {:captureState "lzero"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_function_call_reader/clang/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/clang/basic_function_call_reader.expected index a56d3accc..74f5ae7ad 100644 --- a/src/test/correct/basic_function_call_reader/clang/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/clang/basic_function_call_reader.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -88,7 +88,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -97,13 +97,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -214,7 +214,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000301"} true; @@ -238,33 +238,36 @@ procedure main() } goto l00000345; l00000345: + assume {:captureState "l00000345"} true; R8, Gamma_R8 := 1bv64, true; goto l00000348; l00000342: + assume {:captureState "l00000342"} true; R8, Gamma_R8 := 0bv64, true; goto l00000348; l00000348: + assume {:captureState "l00000348"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000350; } goto l0000037a; l00000350: - assume {:captureState "addr:l00000350"} true; + assume {:captureState "l00000350"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); assume {:captureState "%00000362"} true; goto l00000365; l0000037a: - assume {:captureState "addr:l0000037a"} true; + assume {:captureState "l0000037a"} true; goto l0000037b; l0000037b: - assume {:captureState "addr:l0000037b"} true; + assume {:captureState "l0000037b"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000383"} true; goto l00000365; l00000365: - assume {:captureState "addr:l00000365"} true; + assume {:captureState "l00000365"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_function_call_reader/clang_O2/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/clang_O2/basic_function_call_reader.expected index 201254189..83a41ea67 100644 --- a/src/test/correct/basic_function_call_reader/clang_O2/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/clang_O2/basic_function_call_reader.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -78,7 +78,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -87,13 +87,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -202,7 +202,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); @@ -220,11 +220,14 @@ procedure main() } goto l000002fd; l000002fd: + assume {:captureState "l000002fd"} true; R0, Gamma_R0 := zero_extend32_32(R9[32:0]), Gamma_R9; goto l00000300; l000002f9: + assume {:captureState "l000002f9"} true; R0, Gamma_R0 := 0bv64, true; goto l00000300; l00000300: + assume {:captureState "l00000300"} true; return; } diff --git a/src/test/correct/basic_function_call_reader/clang_no_plt_no_pic/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/clang_no_plt_no_pic/basic_function_call_reader.expected index ea1b0d5bb..a14b648f6 100644 --- a/src/test/correct/basic_function_call_reader/clang_no_plt_no_pic/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/clang_no_plt_no_pic/basic_function_call_reader.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -88,7 +88,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -97,13 +97,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -214,7 +214,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000944"} true; @@ -238,33 +238,36 @@ procedure main() } goto l00000988; l00000988: + assume {:captureState "l00000988"} true; R8, Gamma_R8 := 1bv64, true; goto l0000098b; l00000985: + assume {:captureState "l00000985"} true; R8, Gamma_R8 := 0bv64, true; goto l0000098b; l0000098b: + assume {:captureState "l0000098b"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000993; } goto l000009bd; l00000993: - assume {:captureState "addr:l00000993"} true; + assume {:captureState "l00000993"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); assume {:captureState "%000009a5"} true; goto l000009a8; l000009bd: - assume {:captureState "addr:l000009bd"} true; + assume {:captureState "l000009bd"} true; goto l000009be; l000009be: - assume {:captureState "addr:l000009be"} true; + assume {:captureState "l000009be"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000009c6"} true; goto l000009a8; l000009a8: - assume {:captureState "addr:l000009a8"} true; + assume {:captureState "l000009a8"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_function_call_reader/clang_pic/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/clang_pic/basic_function_call_reader.expected index 23c1b1cd6..ec772c91a 100644 --- a/src/test/correct/basic_function_call_reader/clang_pic/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/clang_pic/basic_function_call_reader.expected @@ -1,60 +1,60 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -112,7 +112,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -121,13 +121,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -270,7 +270,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000309"} true; @@ -298,33 +298,36 @@ procedure main() } goto l0000035b; l0000035b: + assume {:captureState "l0000035b"} true; R8, Gamma_R8 := 1bv64, true; goto l0000035e; l00000358: + assume {:captureState "l00000358"} true; R8, Gamma_R8 := 0bv64, true; goto l0000035e; l0000035e: + assume {:captureState "l0000035e"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000366; } goto l00000390; l00000366: - assume {:captureState "addr:l00000366"} true; + assume {:captureState "l00000366"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); assume {:captureState "%00000378"} true; goto l0000037b; l00000390: - assume {:captureState "addr:l00000390"} true; + assume {:captureState "l00000390"} true; goto l00000391; l00000391: - assume {:captureState "addr:l00000391"} true; + assume {:captureState "l00000391"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000399"} true; goto l0000037b; l0000037b: - assume {:captureState "addr:l0000037b"} true; + assume {:captureState "l0000037b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_function_call_reader/gcc/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/gcc/basic_function_call_reader.expected index 3d639e3be..b2e35d098 100644 --- a/src/test/correct/basic_function_call_reader/gcc/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/gcc/basic_function_call_reader.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -86,7 +86,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -95,13 +95,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -212,7 +212,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; @@ -235,15 +235,15 @@ procedure main() } goto l00000349; l00000332: - assume {:captureState "addr:l00000332"} true; + assume {:captureState "l00000332"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); goto l0000033e; l00000349: - assume {:captureState "addr:l00000349"} true; + assume {:captureState "l00000349"} true; R0, Gamma_R0 := 0bv64, true; goto l0000033e; l0000033e: - assume {:captureState "addr:l0000033e"} true; + assume {:captureState "l0000033e"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_function_call_reader/gcc_O2/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/gcc_O2/basic_function_call_reader.expected index 5790272c3..19620ad7e 100644 --- a/src/test/correct/basic_function_call_reader/gcc_O2/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/gcc_O2/basic_function_call_reader.expected @@ -1,33 +1,33 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -69,7 +69,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -78,13 +78,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -183,7 +183,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -194,11 +194,11 @@ procedure main() } goto l00000398; l00000398: - assume {:captureState "addr:l00000398"} true; + assume {:captureState "l00000398"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 4bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 4bv64)) || L(mem, bvadd64(R1, 4bv64))); goto l000001bc; l000001bc: - assume {:captureState "addr:l000001bc"} true; + assume {:captureState "l000001bc"} true; return; } diff --git a/src/test/correct/basic_function_call_reader/gcc_no_plt_no_pic/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/gcc_no_plt_no_pic/basic_function_call_reader.expected index 2a379e808..af2fdf5d3 100644 --- a/src/test/correct/basic_function_call_reader/gcc_no_plt_no_pic/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/gcc_no_plt_no_pic/basic_function_call_reader.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -86,7 +86,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -95,13 +95,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -212,7 +212,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; @@ -235,15 +235,15 @@ procedure main() } goto l0000094e; l00000937: - assume {:captureState "addr:l00000937"} true; + assume {:captureState "l00000937"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); goto l00000943; l0000094e: - assume {:captureState "addr:l0000094e"} true; + assume {:captureState "l0000094e"} true; R0, Gamma_R0 := 0bv64, true; goto l00000943; l00000943: - assume {:captureState "addr:l00000943"} true; + assume {:captureState "l00000943"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_function_call_reader/gcc_pic/basic_function_call_reader.expected b/src/test/correct/basic_function_call_reader/gcc_pic/basic_function_call_reader.expected index 23d468816..fd8a35964 100644 --- a/src/test/correct/basic_function_call_reader/gcc_pic/basic_function_call_reader.expected +++ b/src/test/correct/basic_function_call_reader/gcc_pic/basic_function_call_reader.expected @@ -1,58 +1,58 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then (memory_load32_le(memory, $x_addr) == 1bv32) else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); @@ -110,7 +110,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); ensures (old(gamma_load32(Gamma_mem, $y_addr)) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); @@ -119,13 +119,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == 0bv32) ==> (memory_load32_le(mem, $x_addr) == 0bv32)); assert (gamma_load32(Gamma_mem, $y_addr) ==> ((memory_load32_le(mem, $x_addr) == 0bv32) || gamma_load32(Gamma_mem, $y_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -268,7 +268,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -293,15 +293,15 @@ procedure main() } goto l0000034b; l00000334: - assume {:captureState "addr:l00000334"} true; + assume {:captureState "l00000334"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); goto l00000340; l0000034b: - assume {:captureState "addr:l0000034b"} true; + assume {:captureState "l0000034b"} true; R0, Gamma_R0 := 0bv64, true; goto l00000340; l00000340: - assume {:captureState "addr:l00000340"} true; + assume {:captureState "l00000340"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/basic_lock_read/clang/basic_lock_read.expected b/src/test/correct/basic_lock_read/clang/basic_lock_read.expected index 30cd1ee30..3fe582cff 100644 --- a/src/test/correct/basic_lock_read/clang/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/clang/basic_lock_read.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -95,12 +95,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -212,7 +212,7 @@ procedure main() var ZF: bv1; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000002f9"} true; @@ -233,22 +233,25 @@ procedure main() } goto l00000330; l00000330: + assume {:captureState "l00000330"} true; R8, Gamma_R8 := 1bv64, true; goto l00000333; l0000032d: + assume {:captureState "l0000032d"} true; R8, Gamma_R8 := 0bv64, true; goto l00000333; l00000333: + assume {:captureState "l00000333"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l0000033b; } goto l00000352; l00000352: - assume {:captureState "addr:l00000352"} true; + assume {:captureState "l00000352"} true; goto l00000353; l00000353: - assume {:captureState "addr:l00000353"} true; + assume {:captureState "l00000353"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> true); @@ -262,7 +265,7 @@ procedure main() assume {:captureState "%0000036f"} true; goto l0000033b; l0000033b: - assume {:captureState "addr:l0000033b"} true; + assume {:captureState "l0000033b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_read/clang_O2/basic_lock_read.expected b/src/test/correct/basic_lock_read/clang_O2/basic_lock_read.expected index 6346d7bd6..1a13cddb4 100644 --- a/src/test/correct/basic_lock_read/clang_O2/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/clang_O2/basic_lock_read.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -84,12 +84,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -189,7 +189,7 @@ procedure main() { var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -199,7 +199,7 @@ procedure main() } goto l000002f7; l000002dc: - assume {:captureState "addr:l000002dc"} true; + assume {:captureState "l000002dc"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> true); @@ -210,7 +210,7 @@ procedure main() R0, Gamma_R0 := 0bv64, true; return; l000002f7: - assume {:captureState "addr:l000002f7"} true; + assume {:captureState "l000002f7"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_lock_read/clang_no_plt_no_pic/basic_lock_read.expected b/src/test/correct/basic_lock_read/clang_no_plt_no_pic/basic_lock_read.expected index ce75ac8f3..ad72f3b57 100644 --- a/src/test/correct/basic_lock_read/clang_no_plt_no_pic/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/clang_no_plt_no_pic/basic_lock_read.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -95,12 +95,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -212,7 +212,7 @@ procedure main() var ZF: bv1; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000924"} true; @@ -233,22 +233,25 @@ procedure main() } goto l0000095b; l0000095b: + assume {:captureState "l0000095b"} true; R8, Gamma_R8 := 1bv64, true; goto l0000095e; l00000958: + assume {:captureState "l00000958"} true; R8, Gamma_R8 := 0bv64, true; goto l0000095e; l0000095e: + assume {:captureState "l0000095e"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000966; } goto l0000097d; l0000097d: - assume {:captureState "addr:l0000097d"} true; + assume {:captureState "l0000097d"} true; goto l0000097e; l0000097e: - assume {:captureState "addr:l0000097e"} true; + assume {:captureState "l0000097e"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> true); @@ -262,7 +265,7 @@ procedure main() assume {:captureState "%0000099a"} true; goto l00000966; l00000966: - assume {:captureState "addr:l00000966"} true; + assume {:captureState "l00000966"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_read/clang_pic/basic_lock_read.expected b/src/test/correct/basic_lock_read/clang_pic/basic_lock_read.expected index 497ebae33..0655b008a 100644 --- a/src/test/correct/basic_lock_read/clang_pic/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/clang_pic/basic_lock_read.expected @@ -1,60 +1,60 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -111,7 +111,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -119,12 +119,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -268,7 +268,7 @@ procedure main() var ZF: bv1; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000301"} true; @@ -291,22 +291,25 @@ procedure main() } goto l0000033f; l0000033f: + assume {:captureState "l0000033f"} true; R8, Gamma_R8 := 1bv64, true; goto l00000342; l0000033c: + assume {:captureState "l0000033c"} true; R8, Gamma_R8 := 0bv64, true; goto l00000342; l00000342: + assume {:captureState "l00000342"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l0000034a; } goto l00000361; l00000361: - assume {:captureState "addr:l00000361"} true; + assume {:captureState "l00000361"} true; goto l00000362; l00000362: - assume {:captureState "addr:l00000362"} true; + assume {:captureState "l00000362"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4040bv64)) || L(mem, bvadd64(R8, 4040bv64))); @@ -322,7 +325,7 @@ procedure main() assume {:captureState "%00000385"} true; goto l0000034a; l0000034a: - assume {:captureState "addr:l0000034a"} true; + assume {:captureState "l0000034a"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_read/gcc/basic_lock_read.expected b/src/test/correct/basic_lock_read/gcc/basic_lock_read.expected index ed5ba3f3c..b5874be65 100644 --- a/src/test/correct/basic_lock_read/gcc/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/gcc/basic_lock_read.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -93,12 +93,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -210,7 +210,7 @@ procedure main() var ZF: bv1; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000002f9"} true; @@ -229,7 +229,7 @@ procedure main() } goto l0000033e; l0000033e: - assume {:captureState "addr:l0000033e"} true; + assume {:captureState "l0000033e"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -246,7 +246,7 @@ procedure main() assume {:captureState "%00000368"} true; goto l00000327; l00000327: - assume {:captureState "addr:l00000327"} true; + assume {:captureState "l00000327"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_read/gcc_O2/basic_lock_read.expected b/src/test/correct/basic_lock_read/gcc_O2/basic_lock_read.expected index 4ce9ccd20..72aeca101 100644 --- a/src/test/correct/basic_lock_read/gcc_O2/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/gcc_O2/basic_lock_read.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69656bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -85,12 +85,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -190,7 +190,7 @@ procedure main() { var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -201,7 +201,7 @@ procedure main() } goto l0000039c; l0000039c: - assume {:captureState "addr:l0000039c"} true; + assume {:captureState "l0000039c"} true; call rely(); assert (L(mem, bvadd64(R1, 4bv64)) ==> true); z_old := memory_load32_le(mem, $z_addr); @@ -210,7 +210,7 @@ procedure main() assume {:captureState "%000003a1"} true; goto l000001bd; l000001bd: - assume {:captureState "addr:l000001bd"} true; + assume {:captureState "l000001bd"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_lock_read/gcc_no_plt_no_pic/basic_lock_read.expected b/src/test/correct/basic_lock_read/gcc_no_plt_no_pic/basic_lock_read.expected index 57655f452..4af98550b 100644 --- a/src/test/correct/basic_lock_read/gcc_no_plt_no_pic/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/gcc_no_plt_no_pic/basic_lock_read.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -93,12 +93,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -210,7 +210,7 @@ procedure main() var ZF: bv1; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%0000091a"} true; @@ -229,7 +229,7 @@ procedure main() } goto l0000095f; l0000095f: - assume {:captureState "addr:l0000095f"} true; + assume {:captureState "l0000095f"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -246,7 +246,7 @@ procedure main() assume {:captureState "%00000989"} true; goto l00000948; l00000948: - assume {:captureState "addr:l00000948"} true; + assume {:captureState "l00000948"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_read/gcc_pic/basic_lock_read.expected b/src/test/correct/basic_lock_read/gcc_pic/basic_lock_read.expected index 3ec27ec86..4b06ef422 100644 --- a/src/test/correct/basic_lock_read/gcc_pic/basic_lock_read.expected +++ b/src/test/correct/basic_lock_read/gcc_pic/basic_lock_read.expected @@ -1,58 +1,58 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -109,7 +109,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -117,12 +117,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -266,7 +266,7 @@ procedure main() var ZF: bv1; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000002f9"} true; @@ -286,7 +286,7 @@ procedure main() } goto l0000033f; l0000033f: - assume {:captureState "addr:l0000033f"} true; + assume {:captureState "l0000033f"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -305,7 +305,7 @@ procedure main() assume {:captureState "%0000036b"} true; goto l00000328; l00000328: - assume {:captureState "addr:l00000328"} true; + assume {:captureState "l00000328"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_read/clang/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/clang/basic_lock_security_read.expected index 5fe7cdbb9..2aba48461 100644 --- a/src/test/correct/basic_lock_security_read/clang/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/clang/basic_lock_security_read.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -95,12 +95,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); @@ -210,7 +210,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000002f5"} true; @@ -231,22 +231,25 @@ procedure main() } goto l0000032c; l0000032c: + assume {:captureState "l0000032c"} true; R8, Gamma_R8 := 1bv64, true; goto l0000032f; l00000329: + assume {:captureState "l00000329"} true; R8, Gamma_R8 := 0bv64, true; goto l0000032f; l0000032f: + assume {:captureState "l0000032f"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000337; } goto l0000034e; l0000034e: - assume {:captureState "addr:l0000034e"} true; + assume {:captureState "l0000034e"} true; goto l0000034f; l0000034f: - assume {:captureState "addr:l0000034f"} true; + assume {:captureState "l0000034f"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); @@ -254,7 +257,7 @@ procedure main() assume {:captureState "%00000364"} true; goto l00000337; l00000337: - assume {:captureState "addr:l00000337"} true; + assume {:captureState "l00000337"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_read/clang_O2/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/clang_O2/basic_lock_security_read.expected index 4acf8a3d2..ac7bd7571 100644 --- a/src/test/correct/basic_lock_security_read/clang_O2/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/clang_O2/basic_lock_security_read.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -85,12 +85,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); @@ -198,7 +198,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); @@ -216,11 +216,14 @@ procedure main() } goto l000002fd; l000002fd: + assume {:captureState "l000002fd"} true; R0, Gamma_R0 := 0bv64, true; goto l00000300; l000002fa: + assume {:captureState "l000002fa"} true; R0, Gamma_R0 := zero_extend32_32(R9[32:0]), Gamma_R9; goto l00000300; l00000300: + assume {:captureState "l00000300"} true; return; } diff --git a/src/test/correct/basic_lock_security_read/clang_no_plt_no_pic/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/clang_no_plt_no_pic/basic_lock_security_read.expected index 34072fcf8..3fc858b76 100644 --- a/src/test/correct/basic_lock_security_read/clang_no_plt_no_pic/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/clang_no_plt_no_pic/basic_lock_security_read.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -95,12 +95,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); @@ -210,7 +210,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000913"} true; @@ -231,22 +231,25 @@ procedure main() } goto l0000094a; l0000094a: + assume {:captureState "l0000094a"} true; R8, Gamma_R8 := 1bv64, true; goto l0000094d; l00000947: + assume {:captureState "l00000947"} true; R8, Gamma_R8 := 0bv64, true; goto l0000094d; l0000094d: + assume {:captureState "l0000094d"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000955; } goto l0000096c; l0000096c: - assume {:captureState "addr:l0000096c"} true; + assume {:captureState "l0000096c"} true; goto l0000096d; l0000096d: - assume {:captureState "addr:l0000096d"} true; + assume {:captureState "l0000096d"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); @@ -254,7 +257,7 @@ procedure main() assume {:captureState "%00000982"} true; goto l00000955; l00000955: - assume {:captureState "addr:l00000955"} true; + assume {:captureState "l00000955"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_read/clang_pic/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/clang_pic/basic_lock_security_read.expected index 17531a14b..695fc0d48 100644 --- a/src/test/correct/basic_lock_security_read/clang_pic/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/clang_pic/basic_lock_security_read.expected @@ -1,60 +1,60 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -111,7 +111,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -119,12 +119,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); @@ -266,7 +266,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000002fd"} true; @@ -289,22 +289,25 @@ procedure main() } goto l0000033b; l0000033b: + assume {:captureState "l0000033b"} true; R8, Gamma_R8 := 1bv64, true; goto l0000033e; l00000338: + assume {:captureState "l00000338"} true; R8, Gamma_R8 := 0bv64, true; goto l0000033e; l0000033e: + assume {:captureState "l0000033e"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000346; } goto l0000035d; l0000035d: - assume {:captureState "addr:l0000035d"} true; + assume {:captureState "l0000035d"} true; goto l0000035e; l0000035e: - assume {:captureState "addr:l0000035e"} true; + assume {:captureState "l0000035e"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4040bv64)) || L(mem, bvadd64(R8, 4040bv64))); @@ -314,7 +317,7 @@ procedure main() assume {:captureState "%0000037a"} true; goto l00000346; l00000346: - assume {:captureState "addr:l00000346"} true; + assume {:captureState "l00000346"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_read/gcc/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/gcc/basic_lock_security_read.expected index ca05a5a54..9006b9cff 100644 --- a/src/test/correct/basic_lock_security_read/gcc/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/gcc/basic_lock_security_read.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -93,12 +93,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); @@ -208,7 +208,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000002ed"} true; @@ -227,7 +227,7 @@ procedure main() } goto l00000332; l00000332: - assume {:captureState "addr:l00000332"} true; + assume {:captureState "l00000332"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -236,7 +236,7 @@ procedure main() assume {:captureState "%0000034a"} true; goto l0000031b; l0000031b: - assume {:captureState "addr:l0000031b"} true; + assume {:captureState "l0000031b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_read/gcc_O2/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/gcc_O2/basic_lock_security_read.expected index 98cce1343..e446b0b58 100644 --- a/src/test/correct/basic_lock_security_read/gcc_O2/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/gcc_O2/basic_lock_security_read.expected @@ -1,36 +1,36 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69656bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -71,7 +71,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -79,12 +79,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; @@ -194,11 +194,11 @@ procedure main() } goto l0000039c; l0000039c: - assume {:captureState "addr:l0000039c"} true; + assume {:captureState "l0000039c"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R2, 4bv64))), (gamma_load32(Gamma_mem, bvadd64(R2, 4bv64)) || L(mem, bvadd64(R2, 4bv64))); goto l000001c2; l000001c2: - assume {:captureState "addr:l000001c2"} true; + assume {:captureState "l000001c2"} true; return; } diff --git a/src/test/correct/basic_lock_security_read/gcc_no_plt_no_pic/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/gcc_no_plt_no_pic/basic_lock_security_read.expected index 0ec9d6cd9..69a940ab5 100644 --- a/src/test/correct/basic_lock_security_read/gcc_no_plt_no_pic/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/gcc_no_plt_no_pic/basic_lock_security_read.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -93,12 +93,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); @@ -208,7 +208,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000008ea"} true; @@ -227,7 +227,7 @@ procedure main() } goto l0000092f; l0000092f: - assume {:captureState "addr:l0000092f"} true; + assume {:captureState "l0000092f"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -236,7 +236,7 @@ procedure main() assume {:captureState "%00000947"} true; goto l00000918; l00000918: - assume {:captureState "addr:l00000918"} true; + assume {:captureState "l00000918"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_read/gcc_pic/basic_lock_security_read.expected b/src/test/correct/basic_lock_security_read/gcc_pic/basic_lock_security_read.expected index a260e19ab..ad3910528 100644 --- a/src/test/correct/basic_lock_security_read/gcc_pic/basic_lock_security_read.expected +++ b/src/test/correct/basic_lock_security_read/gcc_pic/basic_lock_security_read.expected @@ -1,58 +1,58 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); @@ -109,7 +109,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) && (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))))); { @@ -117,12 +117,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); @@ -264,7 +264,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000002ed"} true; @@ -284,7 +284,7 @@ procedure main() } goto l00000333; l00000333: - assume {:captureState "addr:l00000333"} true; + assume {:captureState "l00000333"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -294,7 +294,7 @@ procedure main() assume {:captureState "%0000034c"} true; goto l0000031c; l0000031c: - assume {:captureState "addr:l0000031c"} true; + assume {:captureState "l0000031c"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_lock_security_write/clang/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/clang/basic_lock_security_write.expected index 3215ac6c4..f2f05a0b1 100644 --- a/src/test/correct/basic_lock_security_write/clang/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/clang/basic_lock_security_write.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -91,12 +91,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -201,7 +201,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000002ea"} true; diff --git a/src/test/correct/basic_lock_security_write/clang_O2/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/clang_O2/basic_lock_security_write.expected index 610776107..dd56def9f 100644 --- a/src/test/correct/basic_lock_security_write/clang_O2/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/clang_O2/basic_lock_security_write.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -84,12 +84,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -192,7 +192,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; diff --git a/src/test/correct/basic_lock_security_write/clang_no_plt_no_pic/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/clang_no_plt_no_pic/basic_lock_security_write.expected index 545f5c2ee..f38c4c74d 100644 --- a/src/test/correct/basic_lock_security_write/clang_no_plt_no_pic/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/clang_no_plt_no_pic/basic_lock_security_write.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -91,12 +91,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -201,7 +201,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000008c7"} true; diff --git a/src/test/correct/basic_lock_security_write/clang_pic/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/clang_pic/basic_lock_security_write.expected index de3ed4f9c..f99743610 100644 --- a/src/test/correct/basic_lock_security_write/clang_pic/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/clang_pic/basic_lock_security_write.expected @@ -1,56 +1,56 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -107,7 +107,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -115,12 +115,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -257,7 +257,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000002f2"} true; diff --git a/src/test/correct/basic_lock_security_write/gcc/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/gcc/basic_lock_security_write.expected index 1bde78af8..ba5c4d59d 100644 --- a/src/test/correct/basic_lock_security_write/gcc/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/gcc/basic_lock_security_write.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -87,12 +87,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -197,7 +197,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000302"} true; diff --git a/src/test/correct/basic_lock_security_write/gcc_O2/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/gcc_O2/basic_lock_security_write.expected index d0674a81c..4bbaa34c0 100644 --- a/src/test/correct/basic_lock_security_write/gcc_O2/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/gcc_O2/basic_lock_security_write.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -84,12 +84,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -192,7 +192,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/basic_lock_security_write/gcc_no_plt_no_pic/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/gcc_no_plt_no_pic/basic_lock_security_write.expected index 756ec0e54..b374205cf 100644 --- a/src/test/correct/basic_lock_security_write/gcc_no_plt_no_pic/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/gcc_no_plt_no_pic/basic_lock_security_write.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -87,12 +87,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -197,7 +197,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000925"} true; diff --git a/src/test/correct/basic_lock_security_write/gcc_pic/basic_lock_security_write.expected b/src/test/correct/basic_lock_security_write/gcc_pic/basic_lock_security_write.expected index d3d4f6717..cb4b9c8ca 100644 --- a/src/test/correct/basic_lock_security_write/gcc_pic/basic_lock_security_write.expected +++ b/src/test/correct/basic_lock_security_write/gcc_pic/basic_lock_security_write.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); @@ -103,7 +103,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))) && (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr)))); { @@ -111,12 +111,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)) && (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -253,7 +253,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000302"} true; diff --git a/src/test/correct/basic_lock_unlock/clang/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/clang/basic_lock_unlock.expected index 8571e0d28..52936b563 100644 --- a/src/test/correct/basic_lock_unlock/clang/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/clang/basic_lock_unlock.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -80,12 +80,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -186,7 +186,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); diff --git a/src/test/correct/basic_lock_unlock/clang_O2/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/clang_O2/basic_lock_unlock.expected index 1c48c94b8..d052faebb 100644 --- a/src/test/correct/basic_lock_unlock/clang_O2/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/clang_O2/basic_lock_unlock.expected @@ -1,39 +1,39 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -74,7 +74,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -82,12 +82,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -188,7 +188,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; diff --git a/src/test/correct/basic_lock_unlock/clang_no_plt_no_pic/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/clang_no_plt_no_pic/basic_lock_unlock.expected index 38fc839c6..934a892e7 100644 --- a/src/test/correct/basic_lock_unlock/clang_no_plt_no_pic/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/clang_no_plt_no_pic/basic_lock_unlock.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -80,12 +80,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -186,7 +186,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); diff --git a/src/test/correct/basic_lock_unlock/clang_pic/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/clang_pic/basic_lock_unlock.expected index f9c42273c..1b825317d 100644 --- a/src/test/correct/basic_lock_unlock/clang_pic/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/clang_pic/basic_lock_unlock.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -96,7 +96,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -104,12 +104,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -242,7 +242,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); diff --git a/src/test/correct/basic_lock_unlock/gcc/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/gcc/basic_lock_unlock.expected index 92fa648ce..45c3f0f16 100644 --- a/src/test/correct/basic_lock_unlock/gcc/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/gcc/basic_lock_unlock.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -78,12 +78,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -184,7 +184,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; diff --git a/src/test/correct/basic_lock_unlock/gcc_O2/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/gcc_O2/basic_lock_unlock.expected index e16dad000..4bb063905 100644 --- a/src/test/correct/basic_lock_unlock/gcc_O2/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/gcc_O2/basic_lock_unlock.expected @@ -1,39 +1,39 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R3: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R3: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R3: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} R3: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -74,7 +74,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -82,12 +82,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -188,7 +188,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R3, Gamma_R3 := 1bv64, true; diff --git a/src/test/correct/basic_lock_unlock/gcc_no_plt_no_pic/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/gcc_no_plt_no_pic/basic_lock_unlock.expected index 3fd503dac..7de6a308f 100644 --- a/src/test/correct/basic_lock_unlock/gcc_no_plt_no_pic/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/gcc_no_plt_no_pic/basic_lock_unlock.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -78,12 +78,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -184,7 +184,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; diff --git a/src/test/correct/basic_lock_unlock/gcc_pic/basic_lock_unlock.expected b/src/test/correct/basic_lock_unlock/gcc_pic/basic_lock_unlock.expected index 21faf7ae0..e7f59e5d7 100644 --- a/src/test/correct/basic_lock_unlock/gcc_pic/basic_lock_unlock.expected +++ b/src/test/correct/basic_lock_unlock/gcc_pic/basic_lock_unlock.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -94,7 +94,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); { @@ -102,12 +102,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) == 0bv32) ==> ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)))); @@ -240,7 +240,7 @@ procedure main() var x_old: bv32; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); diff --git a/src/test/correct/basic_loop_assign/clang/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/clang/basic_loop_assign.expected index e640f145d..1702ab871 100644 --- a/src/test/correct/basic_loop_assign/clang/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/clang/basic_loop_assign.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern} {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -80,12 +80,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); @@ -186,7 +186,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 20bv64, true; call rely(); diff --git a/src/test/correct/basic_loop_assign/clang_O2/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/clang_O2/basic_loop_assign.expected index fd335dcf3..8031b1142 100644 --- a/src/test/correct/basic_loop_assign/clang_O2/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/clang_O2/basic_loop_assign.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern} {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -80,12 +80,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); @@ -186,7 +186,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 20bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/basic_loop_assign/clang_no_plt_no_pic/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/clang_no_plt_no_pic/basic_loop_assign.expected index 1fa831faf..45a841343 100644 --- a/src/test/correct/basic_loop_assign/clang_no_plt_no_pic/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/clang_no_plt_no_pic/basic_loop_assign.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern} {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -80,12 +80,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); @@ -186,7 +186,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 20bv64, true; call rely(); diff --git a/src/test/correct/basic_loop_assign/clang_pic/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/clang_pic/basic_loop_assign.expected index a4d7eaa2e..9c2937fd7 100644 --- a/src/test/correct/basic_loop_assign/clang_pic/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/clang_pic/basic_loop_assign.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern} {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -88,7 +88,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -96,12 +96,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); @@ -218,7 +218,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); diff --git a/src/test/correct/basic_loop_assign/gcc/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/gcc/basic_loop_assign.expected index 136c8bbe8..55d86092d 100644 --- a/src/test/correct/basic_loop_assign/gcc/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/gcc/basic_loop_assign.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern} {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -78,12 +78,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); @@ -184,7 +184,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 20bv64, true; diff --git a/src/test/correct/basic_loop_assign/gcc_O2/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/gcc_O2/basic_loop_assign.expected index c4ffcbeff..8a5abed56 100644 --- a/src/test/correct/basic_loop_assign/gcc_O2/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/gcc_O2/basic_loop_assign.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern} {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -80,12 +80,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); @@ -186,7 +186,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 20bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/basic_loop_assign/gcc_no_plt_no_pic/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/gcc_no_plt_no_pic/basic_loop_assign.expected index c57072406..406846cdd 100644 --- a/src/test/correct/basic_loop_assign/gcc_no_plt_no_pic/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/gcc_no_plt_no_pic/basic_loop_assign.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern} {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -78,12 +78,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); @@ -184,7 +184,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 20bv64, true; diff --git a/src/test/correct/basic_loop_assign/gcc_pic/basic_loop_assign.expected b/src/test/correct/basic_loop_assign/gcc_pic/basic_loop_assign.expected index 263ae5ca8..4296b2ef3 100644 --- a/src/test/correct/basic_loop_assign/gcc_pic/basic_loop_assign.expected +++ b/src/test/correct/basic_loop_assign/gcc_pic/basic_loop_assign.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvsle"} bvsle32(bv32, bv32) returns (bool); +function {:extern} {:bvbuiltin "bvslt"} bvslt32(bv32, bv32) returns (bool); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); @@ -86,7 +86,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (((memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(old(memory_load32_le(mem, $x_addr)), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (old(memory_load32_le(mem, $x_addr)) == 20bv32))); { @@ -94,12 +94,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || (bvsle32(memory_load32_le(mem, $x_addr), 10bv32) && bvslt32(memory_load32_le(mem, $x_addr), 10bv32))) || ((memory_load32_le(mem, $x_addr) == 21bv32) && (memory_load32_le(mem, $x_addr) == 20bv32))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) || ((memory_load32_le(mem, $x_addr) == 20bv32) && (memory_load32_le(mem, $x_addr) == 0bv32))) || ((memory_load32_le(mem, $x_addr) == 20bv32) && bvsle32(memory_load32_le(mem, $x_addr), 10bv32))); @@ -216,7 +216,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); diff --git a/src/test/correct/basic_operation_evaluation/clang/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/clang/basic_operation_evaluation.expected index 887ea3b58..ae3f7c2f7 100644 --- a/src/test/correct/basic_operation_evaluation/clang/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/clang/basic_operation_evaluation.expected @@ -1,64 +1,64 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R10: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1952bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -99,7 +99,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -108,9 +108,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -219,7 +219,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 0bv64, true; @@ -259,12 +259,15 @@ procedure main() } goto l000003ce; l000003ce: + assume {:captureState "l000003ce"} true; R9, Gamma_R9 := zero_extend32_32(bvsdiv33(sign_extend1_32(R8[32:0]), sign_extend1_32(R10[32:0]))[32:0]), (Gamma_R10 && Gamma_R8); goto l000003d1; l000003c9: + assume {:captureState "l000003c9"} true; R9, Gamma_R9 := 0bv64, true; goto l000003d1; l000003d1: + assume {:captureState "l000003d1"} true; R9, Gamma_R9 := zero_extend32_32(bvmul64(zero_extend32_32(R9[32:0]), zero_extend32_32(R10[32:0]))[32:0]), (Gamma_R10 && Gamma_R9); #4, Gamma_#4 := bvnot32(R9[32:0]), Gamma_R9; #5, Gamma_#5 := bvadd32(R8[32:0], bvnot32(R9[32:0])), (Gamma_R9 && Gamma_R8); diff --git a/src/test/correct/basic_operation_evaluation/clang_O2/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/clang_O2/basic_operation_evaluation.expected index dfc8a4e7d..b904c03a5 100644 --- a/src/test/correct/basic_operation_evaluation/clang_O2/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/clang_O2/basic_operation_evaluation.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1840bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_operation_evaluation/clang_no_plt_no_pic/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/clang_no_plt_no_pic/basic_operation_evaluation.expected index 73df7b339..c41cd5c12 100644 --- a/src/test/correct/basic_operation_evaluation/clang_no_plt_no_pic/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/clang_no_plt_no_pic/basic_operation_evaluation.expected @@ -1,64 +1,64 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R10: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1952bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -99,7 +99,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -108,9 +108,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -219,7 +219,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 0bv64, true; @@ -259,12 +259,15 @@ procedure main() } goto l00000ab1; l00000ab1: + assume {:captureState "l00000ab1"} true; R9, Gamma_R9 := zero_extend32_32(bvsdiv33(sign_extend1_32(R8[32:0]), sign_extend1_32(R10[32:0]))[32:0]), (Gamma_R10 && Gamma_R8); goto l00000ab4; l00000aac: + assume {:captureState "l00000aac"} true; R9, Gamma_R9 := 0bv64, true; goto l00000ab4; l00000ab4: + assume {:captureState "l00000ab4"} true; R9, Gamma_R9 := zero_extend32_32(bvmul64(zero_extend32_32(R9[32:0]), zero_extend32_32(R10[32:0]))[32:0]), (Gamma_R10 && Gamma_R9); #4, Gamma_#4 := bvnot32(R9[32:0]), Gamma_R9; #5, Gamma_#5 := bvadd32(R8[32:0], bvnot32(R9[32:0])), (Gamma_R9 && Gamma_R8); diff --git a/src/test/correct/basic_operation_evaluation/clang_pic/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/clang_pic/basic_operation_evaluation.expected index 73df7b339..c41cd5c12 100644 --- a/src/test/correct/basic_operation_evaluation/clang_pic/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/clang_pic/basic_operation_evaluation.expected @@ -1,64 +1,64 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R10: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1952bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -99,7 +99,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -108,9 +108,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -219,7 +219,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 0bv64, true; @@ -259,12 +259,15 @@ procedure main() } goto l00000ab1; l00000ab1: + assume {:captureState "l00000ab1"} true; R9, Gamma_R9 := zero_extend32_32(bvsdiv33(sign_extend1_32(R8[32:0]), sign_extend1_32(R10[32:0]))[32:0]), (Gamma_R10 && Gamma_R8); goto l00000ab4; l00000aac: + assume {:captureState "l00000aac"} true; R9, Gamma_R9 := 0bv64, true; goto l00000ab4; l00000ab4: + assume {:captureState "l00000ab4"} true; R9, Gamma_R9 := zero_extend32_32(bvmul64(zero_extend32_32(R9[32:0]), zero_extend32_32(R10[32:0]))[32:0]), (Gamma_R10 && Gamma_R9); #4, Gamma_#4 := bvnot32(R9[32:0]), Gamma_R9; #5, Gamma_#5 := bvadd32(R8[32:0], bvnot32(R9[32:0])), (Gamma_R9 && Gamma_R8); diff --git a/src/test/correct/basic_operation_evaluation/gcc/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/gcc/basic_operation_evaluation.expected index 14d6921a1..2689978a8 100644 --- a/src/test/correct/basic_operation_evaluation/gcc/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/gcc/basic_operation_evaluation.expected @@ -1,56 +1,56 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1948bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,7 +91,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,9 +100,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,7 +199,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%0000032a"} true; @@ -235,12 +235,15 @@ procedure main() } goto l000003b8; l000003b8: + assume {:captureState "l000003b8"} true; R2, Gamma_R2 := zero_extend32_32(bvsdiv33(sign_extend1_32(R0[32:0]), sign_extend1_32(R1[32:0]))[32:0]), (Gamma_R1 && Gamma_R0); goto l000003bb; l000003b3: + assume {:captureState "l000003b3"} true; R2, Gamma_R2 := 0bv64, true; goto l000003bb; l000003bb: + assume {:captureState "l000003bb"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R1, Gamma_R1 := zero_extend32_32(bvmul64(zero_extend32_32(R2[32:0]), zero_extend32_32(R1[32:0]))[32:0]), (Gamma_R1 && Gamma_R2); R0, Gamma_R0 := zero_extend32_32(bvadd32(bvadd32(R0[32:0], bvnot32(R1[32:0])), 1bv32)), (Gamma_R1 && Gamma_R0); diff --git a/src/test/correct/basic_operation_evaluation/gcc_O2/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/gcc_O2/basic_operation_evaluation.expected index db578d839..306991d20 100644 --- a/src/test/correct/basic_operation_evaluation/gcc_O2/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/gcc_O2/basic_operation_evaluation.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1896bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/basic_operation_evaluation/gcc_no_plt_no_pic/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/gcc_no_plt_no_pic/basic_operation_evaluation.expected index c13871a69..dad30a297 100644 --- a/src/test/correct/basic_operation_evaluation/gcc_no_plt_no_pic/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/gcc_no_plt_no_pic/basic_operation_evaluation.expected @@ -1,56 +1,56 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1948bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,7 +91,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,9 +100,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,7 +199,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000009e5"} true; @@ -235,12 +235,15 @@ procedure main() } goto l00000a73; l00000a73: + assume {:captureState "l00000a73"} true; R2, Gamma_R2 := zero_extend32_32(bvsdiv33(sign_extend1_32(R0[32:0]), sign_extend1_32(R1[32:0]))[32:0]), (Gamma_R1 && Gamma_R0); goto l00000a76; l00000a6e: + assume {:captureState "l00000a6e"} true; R2, Gamma_R2 := 0bv64, true; goto l00000a76; l00000a76: + assume {:captureState "l00000a76"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R1, Gamma_R1 := zero_extend32_32(bvmul64(zero_extend32_32(R2[32:0]), zero_extend32_32(R1[32:0]))[32:0]), (Gamma_R1 && Gamma_R2); R0, Gamma_R0 := zero_extend32_32(bvadd32(bvadd32(R0[32:0], bvnot32(R1[32:0])), 1bv32)), (Gamma_R1 && Gamma_R0); diff --git a/src/test/correct/basic_operation_evaluation/gcc_pic/basic_operation_evaluation.expected b/src/test/correct/basic_operation_evaluation/gcc_pic/basic_operation_evaluation.expected index c13871a69..dad30a297 100644 --- a/src/test/correct/basic_operation_evaluation/gcc_pic/basic_operation_evaluation.expected +++ b/src/test/correct/basic_operation_evaluation/gcc_pic/basic_operation_evaluation.expected @@ -1,56 +1,56 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1948bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvmul"} bvmul64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvnot"} bvnot32(bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvor"} bvor32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvsdiv"} bvsdiv33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvxor"} bvxor32(bv32, bv32) returns (bv32); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,7 +91,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,9 +100,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,7 +199,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000009e5"} true; @@ -235,12 +235,15 @@ procedure main() } goto l00000a73; l00000a73: + assume {:captureState "l00000a73"} true; R2, Gamma_R2 := zero_extend32_32(bvsdiv33(sign_extend1_32(R0[32:0]), sign_extend1_32(R1[32:0]))[32:0]), (Gamma_R1 && Gamma_R0); goto l00000a76; l00000a6e: + assume {:captureState "l00000a6e"} true; R2, Gamma_R2 := 0bv64, true; goto l00000a76; l00000a76: + assume {:captureState "l00000a76"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R1, Gamma_R1 := zero_extend32_32(bvmul64(zero_extend32_32(R2[32:0]), zero_extend32_32(R1[32:0]))[32:0]), (Gamma_R1 && Gamma_R2); R0, Gamma_R0 := zero_extend32_32(bvadd32(bvadd32(R0[32:0], bvnot32(R1[32:0])), 1bv32)), (Gamma_R1 && Gamma_R0); diff --git a/src/test/correct/basic_sec_policy_read/clang/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/clang/basic_sec_policy_read.expected index 4cfc49619..7a3d39208 100644 --- a/src/test/correct/basic_sec_policy_read/clang/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/clang/basic_sec_policy_read.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -95,12 +95,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -210,7 +210,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000002f5"} true; @@ -234,27 +234,30 @@ procedure main() } goto l00000339; l00000339: + assume {:captureState "l00000339"} true; R8, Gamma_R8 := 1bv64, true; goto l0000033c; l00000336: + assume {:captureState "l00000336"} true; R8, Gamma_R8 := 0bv64, true; goto l0000033c; l0000033c: + assume {:captureState "l0000033c"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000344; } goto l0000035b; l0000035b: - assume {:captureState "addr:l0000035b"} true; + assume {:captureState "l0000035b"} true; goto l0000035c; l0000035c: - assume {:captureState "addr:l0000035c"} true; + assume {:captureState "l0000035c"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); assume {:captureState "%00000364"} true; goto l00000344; l00000344: - assume {:captureState "addr:l00000344"} true; + assume {:captureState "l00000344"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_read/clang_O2/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/clang_O2/basic_sec_policy_read.expected index a3b6da627..60294d829 100644 --- a/src/test/correct/basic_sec_policy_read/clang_O2/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/clang_O2/basic_sec_policy_read.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -85,12 +85,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -198,7 +198,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); @@ -216,11 +216,14 @@ procedure main() } goto l000002fd; l000002fd: + assume {:captureState "l000002fd"} true; R0, Gamma_R0 := 0bv64, true; goto l00000300; l000002fa: + assume {:captureState "l000002fa"} true; R0, Gamma_R0 := zero_extend32_32(R9[32:0]), Gamma_R9; goto l00000300; l00000300: + assume {:captureState "l00000300"} true; return; } diff --git a/src/test/correct/basic_sec_policy_read/clang_no_plt_no_pic/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/clang_no_plt_no_pic/basic_sec_policy_read.expected index 0177f85d1..990413eb8 100644 --- a/src/test/correct/basic_sec_policy_read/clang_no_plt_no_pic/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/clang_no_plt_no_pic/basic_sec_policy_read.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -95,12 +95,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -210,7 +210,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000913"} true; @@ -234,27 +234,30 @@ procedure main() } goto l00000957; l00000957: + assume {:captureState "l00000957"} true; R8, Gamma_R8 := 1bv64, true; goto l0000095a; l00000954: + assume {:captureState "l00000954"} true; R8, Gamma_R8 := 0bv64, true; goto l0000095a; l0000095a: + assume {:captureState "l0000095a"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000962; } goto l00000979; l00000979: - assume {:captureState "addr:l00000979"} true; + assume {:captureState "l00000979"} true; goto l0000097a; l0000097a: - assume {:captureState "addr:l0000097a"} true; + assume {:captureState "l0000097a"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); assume {:captureState "%00000982"} true; goto l00000962; l00000962: - assume {:captureState "addr:l00000962"} true; + assume {:captureState "l00000962"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_read/clang_pic/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/clang_pic/basic_sec_policy_read.expected index 5b56d78b1..c9874d209 100644 --- a/src/test/correct/basic_sec_policy_read/clang_pic/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/clang_pic/basic_sec_policy_read.expected @@ -1,60 +1,60 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -111,7 +111,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -119,12 +119,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -266,7 +266,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000002fd"} true; @@ -294,27 +294,30 @@ procedure main() } goto l0000034f; l0000034f: + assume {:captureState "l0000034f"} true; R8, Gamma_R8 := 1bv64, true; goto l00000352; l0000034c: + assume {:captureState "l0000034c"} true; R8, Gamma_R8 := 0bv64, true; goto l00000352; l00000352: + assume {:captureState "l00000352"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l0000035a; } goto l00000371; l00000371: - assume {:captureState "addr:l00000371"} true; + assume {:captureState "l00000371"} true; goto l00000372; l00000372: - assume {:captureState "addr:l00000372"} true; + assume {:captureState "l00000372"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), true); assume {:captureState "%0000037a"} true; goto l0000035a; l0000035a: - assume {:captureState "addr:l0000035a"} true; + assume {:captureState "l0000035a"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_read/gcc/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/gcc/basic_sec_policy_read.expected index 9834a0a98..e2420795f 100644 --- a/src/test/correct/basic_sec_policy_read/gcc/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/gcc/basic_sec_policy_read.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -93,12 +93,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -208,7 +208,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; @@ -231,12 +231,12 @@ procedure main() } goto l00000345; l00000345: - assume {:captureState "addr:l00000345"} true; + assume {:captureState "l00000345"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%0000034a"} true; goto l0000032e; l0000032e: - assume {:captureState "addr:l0000032e"} true; + assume {:captureState "l0000032e"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_read/gcc_O2/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/gcc_O2/basic_sec_policy_read.expected index e6a2012ed..ee799a4b7 100644 --- a/src/test/correct/basic_sec_policy_read/gcc_O2/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/gcc_O2/basic_sec_policy_read.expected @@ -1,36 +1,36 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69656bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -71,7 +71,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -79,12 +79,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; @@ -194,11 +194,11 @@ procedure main() } goto l0000039c; l0000039c: - assume {:captureState "addr:l0000039c"} true; + assume {:captureState "l0000039c"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R2, 4bv64))), (gamma_load32(Gamma_mem, bvadd64(R2, 4bv64)) || L(mem, bvadd64(R2, 4bv64))); goto l000001c2; l000001c2: - assume {:captureState "addr:l000001c2"} true; + assume {:captureState "l000001c2"} true; return; } diff --git a/src/test/correct/basic_sec_policy_read/gcc_no_plt_no_pic/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/gcc_no_plt_no_pic/basic_sec_policy_read.expected index c56bd1044..440392f1e 100644 --- a/src/test/correct/basic_sec_policy_read/gcc_no_plt_no_pic/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/gcc_no_plt_no_pic/basic_sec_policy_read.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -93,12 +93,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -208,7 +208,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; @@ -231,12 +231,12 @@ procedure main() } goto l00000942; l00000942: - assume {:captureState "addr:l00000942"} true; + assume {:captureState "l00000942"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000947"} true; goto l0000092b; l0000092b: - assume {:captureState "addr:l0000092b"} true; + assume {:captureState "l0000092b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_read/gcc_pic/basic_sec_policy_read.expected b/src/test/correct/basic_sec_policy_read/gcc_pic/basic_sec_policy_read.expected index 45001e96f..30ee05d48 100644 --- a/src/test/correct/basic_sec_policy_read/gcc_pic/basic_sec_policy_read.expected +++ b/src/test/correct/basic_sec_policy_read/gcc_pic/basic_sec_policy_read.expected @@ -1,58 +1,58 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -109,7 +109,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $z_addr)) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); { @@ -117,12 +117,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); @@ -264,7 +264,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -289,12 +289,12 @@ procedure main() } goto l00000347; l00000347: - assume {:captureState "addr:l00000347"} true; + assume {:captureState "l00000347"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%0000034c"} true; goto l00000330; l00000330: - assume {:captureState "addr:l00000330"} true; + assume {:captureState "l00000330"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/basic_sec_policy_write/clang/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/clang/basic_sec_policy_write.expected index 2dc7e76a3..201b37eeb 100644 --- a/src/test/correct/basic_sec_policy_write/clang/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/clang/basic_sec_policy_write.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -91,12 +91,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -199,7 +199,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000002ee"} true; diff --git a/src/test/correct/basic_sec_policy_write/clang_O2/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/clang_O2/basic_sec_policy_write.expected index 1d4c8067f..9dac0c99a 100644 --- a/src/test/correct/basic_sec_policy_write/clang_O2/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/clang_O2/basic_sec_policy_write.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -78,7 +78,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -86,12 +86,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -192,7 +192,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; diff --git a/src/test/correct/basic_sec_policy_write/clang_no_plt_no_pic/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/clang_no_plt_no_pic/basic_sec_policy_write.expected index ee74210ac..bf97d9983 100644 --- a/src/test/correct/basic_sec_policy_write/clang_no_plt_no_pic/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/clang_no_plt_no_pic/basic_sec_policy_write.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -91,12 +91,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -199,7 +199,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000008d7"} true; diff --git a/src/test/correct/basic_sec_policy_write/clang_pic/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/clang_pic/basic_sec_policy_write.expected index c0e78cc8c..36ab6f168 100644 --- a/src/test/correct/basic_sec_policy_write/clang_pic/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/clang_pic/basic_sec_policy_write.expected @@ -1,56 +1,56 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -107,7 +107,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -115,12 +115,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -255,7 +255,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000002f6"} true; diff --git a/src/test/correct/basic_sec_policy_write/gcc/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/gcc/basic_sec_policy_write.expected index 9a5e68d88..e1602790f 100644 --- a/src/test/correct/basic_sec_policy_write/gcc/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/gcc/basic_sec_policy_write.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -87,12 +87,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -195,7 +195,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000306"} true; diff --git a/src/test/correct/basic_sec_policy_write/gcc_O2/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/gcc_O2/basic_sec_policy_write.expected index c435de35d..08c116932 100644 --- a/src/test/correct/basic_sec_policy_write/gcc_O2/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/gcc_O2/basic_sec_policy_write.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R3: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R3: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R3: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} R3: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -78,7 +78,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -86,12 +86,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -192,7 +192,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R3, Gamma_R3 := 2bv64, true; diff --git a/src/test/correct/basic_sec_policy_write/gcc_no_plt_no_pic/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/gcc_no_plt_no_pic/basic_sec_policy_write.expected index c83866d0f..959c60219 100644 --- a/src/test/correct/basic_sec_policy_write/gcc_no_plt_no_pic/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/gcc_no_plt_no_pic/basic_sec_policy_write.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -87,12 +87,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -195,7 +195,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000935"} true; diff --git a/src/test/correct/basic_sec_policy_write/gcc_pic/basic_sec_policy_write.expected b/src/test/correct/basic_sec_policy_write/gcc_pic/basic_sec_policy_write.expected index 3ba5940fc..1fd3aca8c 100644 --- a/src/test/correct/basic_sec_policy_write/gcc_pic/basic_sec_policy_write.expected +++ b/src/test/correct/basic_sec_policy_write/gcc_pic/basic_sec_policy_write.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); @@ -103,7 +103,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr)); { @@ -111,12 +111,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $z_addr) != 0bv32) ==> (memory_load32_le(mem, $z_addr) != 0bv32)); @@ -251,7 +251,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000306"} true; diff --git a/src/test/correct/basicassign_gamma0/clang/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/clang/basicassign_gamma0.expected index 592173b60..4fd51f050 100644 --- a/src/test/correct/basicassign_gamma0/clang/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/clang/basicassign_gamma0.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69684bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -85,12 +85,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -186,7 +186,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); diff --git a/src/test/correct/basicassign_gamma0/clang_O2/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/clang_O2/basicassign_gamma0.expected index 3d9ca451f..0a66841bf 100644 --- a/src/test/correct/basicassign_gamma0/clang_O2/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/clang_O2/basicassign_gamma0.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69684bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -85,12 +85,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -186,7 +186,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/basicassign_gamma0/clang_no_plt_no_pic/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/clang_no_plt_no_pic/basicassign_gamma0.expected index 06a2746a5..2a980ae8e 100644 --- a/src/test/correct/basicassign_gamma0/clang_no_plt_no_pic/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/clang_no_plt_no_pic/basicassign_gamma0.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69684bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -85,12 +85,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -186,7 +186,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); diff --git a/src/test/correct/basicassign_gamma0/clang_pic/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/clang_pic/basicassign_gamma0.expected index 2677baa88..49233a65d 100644 --- a/src/test/correct/basicassign_gamma0/clang_pic/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/clang_pic/basicassign_gamma0.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69684bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -101,7 +101,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -109,12 +109,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -242,7 +242,7 @@ procedure main() free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4048bv64)) || L(mem, bvadd64(R8, 4048bv64))); diff --git a/src/test/correct/basicassign_gamma0/gcc/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/gcc/basicassign_gamma0.expected index 26c44406d..61c06314d 100644 --- a/src/test/correct/basicassign_gamma0/gcc/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/gcc/basicassign_gamma0.expected @@ -1,40 +1,40 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69656bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -75,7 +75,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -83,12 +83,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -184,7 +184,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); diff --git a/src/test/correct/basicassign_gamma0/gcc_O2/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/gcc_O2/basicassign_gamma0.expected index c4568c2b3..80ca6e118 100644 --- a/src/test/correct/basicassign_gamma0/gcc_O2/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/gcc_O2/basicassign_gamma0.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69656bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -85,12 +85,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -186,7 +186,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/basicassign_gamma0/gcc_no_plt_no_pic/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/gcc_no_plt_no_pic/basicassign_gamma0.expected index a637efeb7..f64a19b05 100644 --- a/src/test/correct/basicassign_gamma0/gcc_no_plt_no_pic/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/gcc_no_plt_no_pic/basicassign_gamma0.expected @@ -1,40 +1,40 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69656bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -75,7 +75,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -83,12 +83,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -184,7 +184,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); diff --git a/src/test/correct/basicassign_gamma0/gcc_pic/basicassign_gamma0.expected b/src/test/correct/basicassign_gamma0/gcc_pic/basicassign_gamma0.expected index d5b33266a..640aca070 100644 --- a/src/test/correct/basicassign_gamma0/gcc_pic/basicassign_gamma0.expected +++ b/src/test/correct/basicassign_gamma0/gcc_pic/basicassign_gamma0.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69656bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); @@ -99,7 +99,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $secret_addr) == old(memory_load32_le(mem, $secret_addr))); { @@ -107,12 +107,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $secret_addr) == memory_load32_le(mem, $secret_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -240,7 +240,7 @@ procedure main() free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); diff --git a/src/test/correct/basicfree/clang/basicfree.expected b/src/test/correct/basicfree/clang/basicfree.expected index aefe5e23c..726176432 100644 --- a/src/test/correct/basicfree/clang/basicfree.expected +++ b/src/test/correct/basicfree/clang/basicfree.expected @@ -1,59 +1,59 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2080bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,9 +103,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -283,7 +283,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -296,7 +296,7 @@ procedure main() call malloc(); goto l0000030d; l0000030d: - assume {:captureState "addr:l0000030d"} true; + assume {:captureState "l0000030d"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); assume {:captureState "%00000313"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -310,7 +310,7 @@ procedure main() call #free(); goto l00000338; l00000338: - assume {:captureState "addr:l00000338"} true; + assume {:captureState "l00000338"} true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(#5, 8bv64)), gamma_load64(Gamma_stack, bvadd64(#5, 8bv64)); diff --git a/src/test/correct/basicfree/clang_O2/basicfree.expected b/src/test/correct/basicfree/clang_O2/basicfree.expected index a691307d3..ae43ad872 100644 --- a/src/test/correct/basicfree/clang_O2/basicfree.expected +++ b/src/test/correct/basicfree/clang_O2/basicfree.expected @@ -1,12 +1,12 @@ -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} mem: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1836bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -47,7 +47,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,9 +56,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -152,6 +152,6 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; return; } diff --git a/src/test/correct/basicfree/clang_no_plt_no_pic/basicfree.expected b/src/test/correct/basicfree/clang_no_plt_no_pic/basicfree.expected index 0cbefca5a..76c2aa03f 100644 --- a/src/test/correct/basicfree/clang_no_plt_no_pic/basicfree.expected +++ b/src/test/correct/basicfree/clang_no_plt_no_pic/basicfree.expected @@ -1,59 +1,59 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2080bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,9 +103,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -283,7 +283,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -296,7 +296,7 @@ procedure main() call malloc(); goto l000008ed; l000008ed: - assume {:captureState "addr:l000008ed"} true; + assume {:captureState "l000008ed"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); assume {:captureState "%000008f3"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -310,7 +310,7 @@ procedure main() call #free(); goto l00000918; l00000918: - assume {:captureState "addr:l00000918"} true; + assume {:captureState "l00000918"} true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(#5, 8bv64)), gamma_load64(Gamma_stack, bvadd64(#5, 8bv64)); diff --git a/src/test/correct/basicfree/clang_pic/basicfree.expected b/src/test/correct/basicfree/clang_pic/basicfree.expected index 0cbefca5a..76c2aa03f 100644 --- a/src/test/correct/basicfree/clang_pic/basicfree.expected +++ b/src/test/correct/basicfree/clang_pic/basicfree.expected @@ -1,59 +1,59 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2080bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69694bv64) == 0bv8); free ensures (memory_load8_le(mem, 69695bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,9 +103,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -283,7 +283,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -296,7 +296,7 @@ procedure main() call malloc(); goto l000008ed; l000008ed: - assume {:captureState "addr:l000008ed"} true; + assume {:captureState "l000008ed"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); assume {:captureState "%000008f3"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -310,7 +310,7 @@ procedure main() call #free(); goto l00000918; l00000918: - assume {:captureState "addr:l00000918"} true; + assume {:captureState "l00000918"} true; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(#5, 8bv64)), gamma_load64(Gamma_stack, bvadd64(#5, 8bv64)); diff --git a/src/test/correct/basicfree/gcc/basicfree.expected b/src/test/correct/basicfree/gcc/basicfree.expected index dfa99df58..0abdad17b 100644 --- a/src/test/correct/basicfree/gcc/basicfree.expected +++ b/src/test/correct/basicfree/gcc/basicfree.expected @@ -1,57 +1,57 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2076bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,9 +101,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -279,7 +279,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%000002e8"} true; @@ -292,7 +292,7 @@ procedure main() call malloc(); goto l00000307; l00000307: - assume {:captureState "addr:l00000307"} true; + assume {:captureState "l00000307"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); assume {:captureState "%0000030d"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); @@ -306,7 +306,7 @@ procedure main() call #free(); goto l00000332; l00000332: - assume {:captureState "addr:l00000332"} true; + assume {:captureState "l00000332"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; diff --git a/src/test/correct/basicfree/gcc_O2/basicfree.expected b/src/test/correct/basicfree/gcc_O2/basicfree.expected index 9c7036705..f96261171 100644 --- a/src/test/correct/basicfree/gcc_O2/basicfree.expected +++ b/src/test/correct/basicfree/gcc_O2/basicfree.expected @@ -1,12 +1,12 @@ -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} mem: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1896bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -47,7 +47,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,9 +56,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -152,6 +152,6 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; return; } diff --git a/src/test/correct/basicfree/gcc_no_plt_no_pic/basicfree.expected b/src/test/correct/basicfree/gcc_no_plt_no_pic/basicfree.expected index 10bf388a9..07b9f0233 100644 --- a/src/test/correct/basicfree/gcc_no_plt_no_pic/basicfree.expected +++ b/src/test/correct/basicfree/gcc_no_plt_no_pic/basicfree.expected @@ -1,57 +1,57 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2076bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,9 +101,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -279,7 +279,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%000008bd"} true; @@ -292,7 +292,7 @@ procedure main() call malloc(); goto l000008dc; l000008dc: - assume {:captureState "addr:l000008dc"} true; + assume {:captureState "l000008dc"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); assume {:captureState "%000008e2"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); @@ -306,7 +306,7 @@ procedure main() call #free(); goto l00000907; l00000907: - assume {:captureState "addr:l00000907"} true; + assume {:captureState "l00000907"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; diff --git a/src/test/correct/basicfree/gcc_pic/basicfree.expected b/src/test/correct/basicfree/gcc_pic/basicfree.expected index 10bf388a9..07b9f0233 100644 --- a/src/test/correct/basicfree/gcc_pic/basicfree.expected +++ b/src/test/correct/basicfree/gcc_pic/basicfree.expected @@ -1,57 +1,57 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2076bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,9 +101,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -279,7 +279,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%000008bd"} true; @@ -292,7 +292,7 @@ procedure main() call malloc(); goto l000008dc; l000008dc: - assume {:captureState "addr:l000008dc"} true; + assume {:captureState "l000008dc"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); assume {:captureState "%000008e2"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); @@ -306,7 +306,7 @@ procedure main() call #free(); goto l00000907; l00000907: - assume {:captureState "addr:l00000907"} true; + assume {:captureState "l00000907"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; diff --git a/src/test/correct/cjump/clang/cjump.expected b/src/test/correct/cjump/clang/cjump.expected index 8e118cae7..fabe193c7 100644 --- a/src/test/correct/cjump/clang/cjump.expected +++ b/src/test/correct/cjump/clang/cjump.expected @@ -1,54 +1,54 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,9 +98,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -209,7 +209,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000309"} true; @@ -233,19 +233,22 @@ procedure main() } goto l00000346; l00000346: + assume {:captureState "l00000346"} true; R8, Gamma_R8 := 1bv64, true; goto l00000349; l00000343: + assume {:captureState "l00000343"} true; R8, Gamma_R8 := 0bv64, true; goto l00000349; l00000349: + assume {:captureState "l00000349"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000351; } goto l0000037e; l00000351: - assume {:captureState "addr:l00000351"} true; + assume {:captureState "l00000351"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 2bv64, true; call rely(); @@ -254,10 +257,10 @@ procedure main() assume {:captureState "%00000366"} true; goto l00000369; l0000037e: - assume {:captureState "addr:l0000037e"} true; + assume {:captureState "l0000037e"} true; goto l0000037f; l0000037f: - assume {:captureState "addr:l0000037f"} true; + assume {:captureState "l0000037f"} true; R8, Gamma_R8 := 3bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); @@ -266,7 +269,7 @@ procedure main() assume {:captureState "%00000392"} true; goto l00000369; l00000369: - assume {:captureState "addr:l00000369"} true; + assume {:captureState "l00000369"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/cjump/clang_O2/cjump.expected b/src/test/correct/cjump/clang_O2/cjump.expected index 34ba4ea5d..d3e291679 100644 --- a/src/test/correct/cjump/clang_O2/cjump.expected +++ b/src/test/correct/cjump/clang_O2/cjump.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R11: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R11: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R11: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R11: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,9 +85,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -184,7 +184,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; diff --git a/src/test/correct/cjump/clang_no_plt_no_pic/cjump.expected b/src/test/correct/cjump/clang_no_plt_no_pic/cjump.expected index facdc706e..55f0aa5e5 100644 --- a/src/test/correct/cjump/clang_no_plt_no_pic/cjump.expected +++ b/src/test/correct/cjump/clang_no_plt_no_pic/cjump.expected @@ -1,54 +1,54 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,9 +98,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -209,7 +209,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%0000095f"} true; @@ -233,19 +233,22 @@ procedure main() } goto l0000099c; l0000099c: + assume {:captureState "l0000099c"} true; R8, Gamma_R8 := 1bv64, true; goto l0000099f; l00000999: + assume {:captureState "l00000999"} true; R8, Gamma_R8 := 0bv64, true; goto l0000099f; l0000099f: + assume {:captureState "l0000099f"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l000009a7; } goto l000009d4; l000009a7: - assume {:captureState "addr:l000009a7"} true; + assume {:captureState "l000009a7"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 2bv64, true; call rely(); @@ -254,10 +257,10 @@ procedure main() assume {:captureState "%000009bc"} true; goto l000009bf; l000009d4: - assume {:captureState "addr:l000009d4"} true; + assume {:captureState "l000009d4"} true; goto l000009d5; l000009d5: - assume {:captureState "addr:l000009d5"} true; + assume {:captureState "l000009d5"} true; R8, Gamma_R8 := 3bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); @@ -266,7 +269,7 @@ procedure main() assume {:captureState "%000009e8"} true; goto l000009bf; l000009bf: - assume {:captureState "addr:l000009bf"} true; + assume {:captureState "l000009bf"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/cjump/clang_pic/cjump.expected b/src/test/correct/cjump/clang_pic/cjump.expected index e166fd0e8..cf22bf2b8 100644 --- a/src/test/correct/cjump/clang_pic/cjump.expected +++ b/src/test/correct/cjump/clang_pic/cjump.expected @@ -1,62 +1,62 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -113,7 +113,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -122,9 +122,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -265,7 +265,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000315"} true; @@ -291,19 +291,22 @@ procedure main() } goto l00000359; l00000359: + assume {:captureState "l00000359"} true; R8, Gamma_R8 := 1bv64, true; goto l0000035c; l00000356: + assume {:captureState "l00000356"} true; R8, Gamma_R8 := 0bv64, true; goto l0000035c; l0000035c: + assume {:captureState "l0000035c"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000364; } goto l00000398; l00000364: - assume {:captureState "addr:l00000364"} true; + assume {:captureState "l00000364"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4048bv64)) || L(mem, bvadd64(R9, 4048bv64))); @@ -314,10 +317,10 @@ procedure main() assume {:captureState "%00000380"} true; goto l00000383; l00000398: - assume {:captureState "addr:l00000398"} true; + assume {:captureState "l00000398"} true; goto l00000399; l00000399: - assume {:captureState "addr:l00000399"} true; + assume {:captureState "l00000399"} true; R8, Gamma_R8 := 3bv64, true; R9, Gamma_R9 := 65536bv64, true; call rely(); @@ -328,7 +331,7 @@ procedure main() assume {:captureState "%000003b3"} true; goto l00000383; l00000383: - assume {:captureState "addr:l00000383"} true; + assume {:captureState "l00000383"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/cjump/gcc/cjump.expected b/src/test/correct/cjump/gcc/cjump.expected index 285553345..8c4250ee0 100644 --- a/src/test/correct/cjump/gcc/cjump.expected +++ b/src/test/correct/cjump/gcc/cjump.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,9 +92,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -201,7 +201,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -224,7 +224,7 @@ procedure main() } goto l00000365; l0000033e: - assume {:captureState "addr:l0000033e"} true; + assume {:captureState "l0000033e"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 2bv64, true; @@ -234,7 +234,7 @@ procedure main() assume {:captureState "%00000359"} true; goto l0000035b; l00000365: - assume {:captureState "addr:l00000365"} true; + assume {:captureState "l00000365"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 3bv64, true; @@ -244,7 +244,7 @@ procedure main() assume {:captureState "%0000037b"} true; goto l0000035b; l0000035b: - assume {:captureState "addr:l0000035b"} true; + assume {:captureState "l0000035b"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/cjump/gcc_O2/cjump.expected b/src/test/correct/cjump/gcc_O2/cjump.expected index 50db70672..a280e9d8a 100644 --- a/src/test/correct/cjump/gcc_O2/cjump.expected +++ b/src/test/correct/cjump/gcc_O2/cjump.expected @@ -1,39 +1,39 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R3: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R3: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R3: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} R3: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -74,7 +74,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,9 +83,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R0, 20bv64), Gamma_R0; R3, Gamma_R3 := 1bv64, true; diff --git a/src/test/correct/cjump/gcc_no_plt_no_pic/cjump.expected b/src/test/correct/cjump/gcc_no_plt_no_pic/cjump.expected index 8cd715879..6bac2205c 100644 --- a/src/test/correct/cjump/gcc_no_plt_no_pic/cjump.expected +++ b/src/test/correct/cjump/gcc_no_plt_no_pic/cjump.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,9 +92,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -201,7 +201,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -224,7 +224,7 @@ procedure main() } goto l000009a3; l0000097c: - assume {:captureState "addr:l0000097c"} true; + assume {:captureState "l0000097c"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 2bv64, true; @@ -234,7 +234,7 @@ procedure main() assume {:captureState "%00000997"} true; goto l00000999; l000009a3: - assume {:captureState "addr:l000009a3"} true; + assume {:captureState "l000009a3"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 3bv64, true; @@ -244,7 +244,7 @@ procedure main() assume {:captureState "%000009b9"} true; goto l00000999; l00000999: - assume {:captureState "addr:l00000999"} true; + assume {:captureState "l00000999"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/cjump/gcc_pic/cjump.expected b/src/test/correct/cjump/gcc_pic/cjump.expected index b18dd05e0..5b1dca745 100644 --- a/src/test/correct/cjump/gcc_pic/cjump.expected +++ b/src/test/correct/cjump/gcc_pic/cjump.expected @@ -1,56 +1,56 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -107,7 +107,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -116,9 +116,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -257,7 +257,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -282,7 +282,7 @@ procedure main() } goto l00000368; l00000340: - assume {:captureState "addr:l00000340"} true; + assume {:captureState "l00000340"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -293,7 +293,7 @@ procedure main() assume {:captureState "%0000035c"} true; goto l0000035e; l00000368: - assume {:captureState "addr:l00000368"} true; + assume {:captureState "l00000368"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); @@ -304,7 +304,7 @@ procedure main() assume {:captureState "%0000037f"} true; goto l0000035e; l0000035e: - assume {:captureState "addr:l0000035e"} true; + assume {:captureState "l0000035e"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/function/clang/function.expected b/src/test/correct/function/clang/function.expected index 398b77936..5f0453715 100644 --- a/src/test/correct/function/clang/function.expected +++ b/src/test/correct/function/clang/function.expected @@ -1,61 +1,61 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,7 +96,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -105,9 +105,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -187,7 +187,7 @@ procedure get_two() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lget_two: - assume {:captureState "addr:lget_two"} true; + assume {:captureState "lget_two"} true; R0, Gamma_R0 := 2bv64, true; return; } @@ -292,7 +292,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%000008db"} true; @@ -310,7 +310,7 @@ procedure main() call get_two(); goto l00000910; l00000910: - assume {:captureState "addr:l00000910"} true; + assume {:captureState "l00000910"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> Gamma_R0); diff --git a/src/test/correct/function/clang_O2/function.expected b/src/test/correct/function/clang_O2/function.expected index 352903a5b..fd677be34 100644 --- a/src/test/correct/function/clang_O2/function.expected +++ b/src/test/correct/function/clang_O2/function.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R11: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R11: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R11: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R11: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,9 +85,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -184,7 +184,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; diff --git a/src/test/correct/function/clang_no_plt_no_pic/function.expected b/src/test/correct/function/clang_no_plt_no_pic/function.expected index 398b77936..5f0453715 100644 --- a/src/test/correct/function/clang_no_plt_no_pic/function.expected +++ b/src/test/correct/function/clang_no_plt_no_pic/function.expected @@ -1,61 +1,61 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,7 +96,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -105,9 +105,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -187,7 +187,7 @@ procedure get_two() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lget_two: - assume {:captureState "addr:lget_two"} true; + assume {:captureState "lget_two"} true; R0, Gamma_R0 := 2bv64, true; return; } @@ -292,7 +292,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%000008db"} true; @@ -310,7 +310,7 @@ procedure main() call get_two(); goto l00000910; l00000910: - assume {:captureState "addr:l00000910"} true; + assume {:captureState "l00000910"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 56bv64)) ==> Gamma_R0); diff --git a/src/test/correct/function/clang_pic/function.expected b/src/test/correct/function/clang_pic/function.expected index ba84e8c55..3937a0029 100644 --- a/src/test/correct/function/clang_pic/function.expected +++ b/src/test/correct/function/clang_pic/function.expected @@ -1,61 +1,61 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -112,7 +112,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -121,9 +121,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -235,7 +235,7 @@ procedure get_two() free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { lget_two: - assume {:captureState "addr:lget_two"} true; + assume {:captureState "lget_two"} true; R0, Gamma_R0 := 2bv64, true; return; } @@ -372,7 +372,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%000002f0"} true; @@ -392,7 +392,7 @@ procedure main() call get_two(); goto l0000032c; l0000032c: - assume {:captureState "addr:l0000032c"} true; + assume {:captureState "l0000032c"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4048bv64)) || L(mem, bvadd64(R8, 4048bv64))); diff --git a/src/test/correct/function/gcc/function.expected b/src/test/correct/function/gcc/function.expected index 7d4e83549..81e902be8 100644 --- a/src/test/correct/function/gcc/function.expected +++ b/src/test/correct/function/gcc/function.expected @@ -1,60 +1,60 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -95,7 +95,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -104,9 +104,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -186,7 +186,7 @@ procedure get_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lget_two: - assume {:captureState "addr:lget_two"} true; + assume {:captureState "lget_two"} true; R0, Gamma_R0 := 2bv64, true; return; } @@ -291,7 +291,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%0000090b"} true; @@ -310,7 +310,7 @@ procedure main() call get_two(); goto l00000946; l00000946: - assume {:captureState "addr:l00000946"} true; + assume {:captureState "l00000946"} true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; diff --git a/src/test/correct/function/gcc_O2/function.expected b/src/test/correct/function/gcc_O2/function.expected index d08cc3d3b..d1f3a9437 100644 --- a/src/test/correct/function/gcc_O2/function.expected +++ b/src/test/correct/function/gcc_O2/function.expected @@ -1,39 +1,39 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R3: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R3: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R3: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} R3: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -74,7 +74,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,9 +83,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R0, 20bv64), Gamma_R0; R3, Gamma_R3 := 1bv64, true; diff --git a/src/test/correct/function/gcc_no_plt_no_pic/function.expected b/src/test/correct/function/gcc_no_plt_no_pic/function.expected index 7d4e83549..81e902be8 100644 --- a/src/test/correct/function/gcc_no_plt_no_pic/function.expected +++ b/src/test/correct/function/gcc_no_plt_no_pic/function.expected @@ -1,60 +1,60 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -95,7 +95,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -104,9 +104,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -186,7 +186,7 @@ procedure get_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lget_two: - assume {:captureState "addr:lget_two"} true; + assume {:captureState "lget_two"} true; R0, Gamma_R0 := 2bv64, true; return; } @@ -291,7 +291,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%0000090b"} true; @@ -310,7 +310,7 @@ procedure main() call get_two(); goto l00000946; l00000946: - assume {:captureState "addr:l00000946"} true; + assume {:captureState "l00000946"} true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; diff --git a/src/test/correct/function/gcc_pic/function.expected b/src/test/correct/function/gcc_pic/function.expected index e53787b44..ecdb2f43c 100644 --- a/src/test/correct/function/gcc_pic/function.expected +++ b/src/test/correct/function/gcc_pic/function.expected @@ -1,60 +1,60 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -111,7 +111,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -120,9 +120,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -234,7 +234,7 @@ procedure get_two() free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { lget_two: - assume {:captureState "addr:lget_two"} true; + assume {:captureState "lget_two"} true; R0, Gamma_R0 := 2bv64, true; return; } @@ -371,7 +371,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%000002f4"} true; @@ -391,7 +391,7 @@ procedure main() call get_two(); goto l00000330; l00000330: - assume {:captureState "addr:l00000330"} true; + assume {:captureState "l00000330"} true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 65536bv64, true; call rely(); diff --git a/src/test/correct/function1/clang/function1.expected b/src/test/correct/function1/clang/function1.expected index 0add677c0..22620843f 100644 --- a/src/test/correct/function1/clang/function1.expected +++ b/src/test/correct/function1/clang/function1.expected @@ -1,91 +1,91 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R2: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2024bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69692bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69696bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "sign_extend 32"} sign_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 32"} sign_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -130,7 +130,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -139,9 +139,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -230,7 +230,7 @@ procedure get_two() free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { lget_two: - assume {:captureState "addr:lget_two"} true; + assume {:captureState "lget_two"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); assume {:captureState "%00000336"} true; @@ -354,7 +354,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000386"} true; @@ -377,7 +377,7 @@ procedure main() call get_two(); goto l000003ce; l000003ce: - assume {:captureState "addr:l000003ce"} true; + assume {:captureState "l000003ce"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 64bv64)) ==> Gamma_R0); @@ -391,7 +391,7 @@ procedure main() call printf(); goto l000003f5; l000003f5: - assume {:captureState "addr:l000003f5"} true; + assume {:captureState "l000003f5"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function1/clang_O2/function1.expected b/src/test/correct/function1/clang_O2/function1.expected index 74f09f520..bddeefebb 100644 --- a/src/test/correct/function1/clang_O2/function1.expected +++ b/src/test/correct/function1/clang_O2/function1.expected @@ -1,70 +1,70 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R11: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R10: bv64; -var {:extern } R11: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R11: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R10: bv64; +var {:extern} R11: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1976bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69692bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69696bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,7 +109,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -118,9 +118,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -229,7 +229,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000317"} true; @@ -258,7 +258,7 @@ procedure main() call printf(); goto l00000371; l00000371: - assume {:captureState "addr:l00000371"} true; + assume {:captureState "l00000371"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function1/clang_no_plt_no_pic/function1.expected b/src/test/correct/function1/clang_no_plt_no_pic/function1.expected index 5b4c159e3..aa6caaf17 100644 --- a/src/test/correct/function1/clang_no_plt_no_pic/function1.expected +++ b/src/test/correct/function1/clang_no_plt_no_pic/function1.expected @@ -1,91 +1,91 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R2: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2024bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69692bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69696bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "sign_extend 32"} sign_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 32"} sign_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -130,7 +130,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -139,9 +139,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -230,7 +230,7 @@ procedure get_two() free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); { lget_two: - assume {:captureState "addr:lget_two"} true; + assume {:captureState "lget_two"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); assume {:captureState "%00000a47"} true; @@ -354,7 +354,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000a97"} true; @@ -377,7 +377,7 @@ procedure main() call get_two(); goto l00000adf; l00000adf: - assume {:captureState "addr:l00000adf"} true; + assume {:captureState "l00000adf"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); assert (L(mem, bvadd64(R8, 64bv64)) ==> Gamma_R0); @@ -391,7 +391,7 @@ procedure main() call printf(); goto l00000b06; l00000b06: - assume {:captureState "addr:l00000b06"} true; + assume {:captureState "l00000b06"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function1/clang_pic/function1.expected b/src/test/correct/function1/clang_pic/function1.expected index b44421cc6..2c77c2294 100644 --- a/src/test/correct/function1/clang_pic/function1.expected +++ b/src/test/correct/function1/clang_pic/function1.expected @@ -1,91 +1,91 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R2: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2096bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69692bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69696bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "sign_extend 32"} sign_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 32"} sign_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -146,7 +146,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69590bv64) == 0bv8); free ensures (memory_load8_le(mem, 69591bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -155,9 +155,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -278,7 +278,7 @@ procedure get_two() free ensures (memory_load8_le(mem, 69591bv64) == 0bv8); { lget_two: - assume {:captureState "addr:lget_two"} true; + assume {:captureState "lget_two"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); assume {:captureState "%0000033e"} true; @@ -434,7 +434,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%0000038e"} true; @@ -459,7 +459,7 @@ procedure main() call get_two(); goto l000003dd; l000003dd: - assume {:captureState "addr:l000003dd"} true; + assume {:captureState "l000003dd"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4048bv64)) || L(mem, bvadd64(R8, 4048bv64))); @@ -475,7 +475,7 @@ procedure main() call printf(); goto l0000040b; l0000040b: - assume {:captureState "addr:l0000040b"} true; + assume {:captureState "l0000040b"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function1/gcc/function1.expected b/src/test/correct/function1/gcc/function1.expected index 4f9f2bc7c..a95a503aa 100644 --- a/src/test/correct/function1/gcc/function1.expected +++ b/src/test/correct/function1/gcc/function1.expected @@ -1,86 +1,86 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R2: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2048bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -129,7 +129,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -138,9 +138,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -237,7 +237,7 @@ procedure get_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lget_two: - assume {:captureState "addr:lget_two"} true; + assume {:captureState "lget_two"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); assume {:captureState "%0000034e"} true; @@ -369,7 +369,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%0000039e"} true; @@ -393,7 +393,7 @@ procedure main() call get_two(); goto l000003ec; l000003ec: - assume {:captureState "addr:l000003ec"} true; + assume {:captureState "l000003ec"} true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; @@ -412,7 +412,7 @@ procedure main() call printf(); goto l00000430; l00000430: - assume {:captureState "addr:l00000430"} true; + assume {:captureState "l00000430"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function1/gcc_O2/function1.expected b/src/test/correct/function1/gcc_O2/function1.expected index 2e492384e..8296db663 100644 --- a/src/test/correct/function1/gcc_O2/function1.expected +++ b/src/test/correct/function1/gcc_O2/function1.expected @@ -1,66 +1,66 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R3: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R3: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R3: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R2: bv64; +var {:extern} R29: bv64; +var {:extern} R3: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2048bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,7 +109,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -118,9 +118,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure __printf_chk(); @@ -328,7 +328,7 @@ procedure main() var #1: bv64; var Gamma_#1: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); assume {:captureState "%000001ca"} true; @@ -355,7 +355,7 @@ procedure main() call __printf_chk(); goto l0000021a; l0000021a: - assume {:captureState "addr:l0000021a"} true; + assume {:captureState "l0000021a"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function1/gcc_no_plt_no_pic/function1.expected b/src/test/correct/function1/gcc_no_plt_no_pic/function1.expected index 1a5d7358f..711e70cf1 100644 --- a/src/test/correct/function1/gcc_no_plt_no_pic/function1.expected +++ b/src/test/correct/function1/gcc_no_plt_no_pic/function1.expected @@ -1,86 +1,86 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R2: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2048bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -129,7 +129,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -138,9 +138,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -237,7 +237,7 @@ procedure get_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lget_two: - assume {:captureState "addr:lget_two"} true; + assume {:captureState "lget_two"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); assume {:captureState "%00000aa6"} true; @@ -369,7 +369,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000af6"} true; @@ -393,7 +393,7 @@ procedure main() call get_two(); goto l00000b44; l00000b44: - assume {:captureState "addr:l00000b44"} true; + assume {:captureState "l00000b44"} true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; @@ -412,7 +412,7 @@ procedure main() call printf(); goto l00000b88; l00000b88: - assume {:captureState "addr:l00000b88"} true; + assume {:captureState "l00000b88"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/function1/gcc_pic/function1.expected b/src/test/correct/function1/gcc_pic/function1.expected index 25885ad0b..313d20eac 100644 --- a/src/test/correct/function1/gcc_pic/function1.expected +++ b/src/test/correct/function1/gcc_pic/function1.expected @@ -1,86 +1,86 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R2: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2112bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -145,7 +145,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -154,9 +154,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure get_two() @@ -285,7 +285,7 @@ procedure get_two() free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); { lget_two: - assume {:captureState "addr:lget_two"} true; + assume {:captureState "lget_two"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store8_le(stack, bvadd64(R31, 15bv64), R0[8:0]), gamma_store8(Gamma_stack, bvadd64(R31, 15bv64), Gamma_R0); assume {:captureState "%0000034e"} true; @@ -449,7 +449,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%0000039e"} true; @@ -474,7 +474,7 @@ procedure main() call get_two(); goto l000003ed; l000003ed: - assume {:captureState "addr:l000003ed"} true; + assume {:captureState "l000003ed"} true; R1, Gamma_R1 := zero_extend32_32(R0[32:0]), Gamma_R0; R0, Gamma_R0 := 65536bv64, true; call rely(); @@ -495,7 +495,7 @@ procedure main() call printf(); goto l00000433; l00000433: - assume {:captureState "addr:l00000433"} true; + assume {:captureState "l00000433"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/functions_with_params/clang/functions_with_params.expected b/src/test/correct/functions_with_params/clang/functions_with_params.expected index dc31bec22..dfe4dc6cb 100644 --- a/src/test/correct/functions_with_params/clang/functions_with_params.expected +++ b/src/test/correct/functions_with_params/clang/functions_with_params.expected @@ -1,59 +1,59 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1912bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,9 +103,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -208,7 +208,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -227,7 +227,7 @@ procedure main() call plus_one(); goto l00000366; l00000366: - assume {:captureState "addr:l00000366"} true; + assume {:captureState "l00000366"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R0); assume {:captureState "%0000036c"} true; R0, Gamma_R0 := 0bv64, true; @@ -316,7 +316,7 @@ procedure plus_one() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lplus_one: - assume {:captureState "addr:lplus_one"} true; + assume {:captureState "lplus_one"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%0000034c"} true; diff --git a/src/test/correct/functions_with_params/clang_O2/functions_with_params.expected b/src/test/correct/functions_with_params/clang_O2/functions_with_params.expected index 0c551beb5..c92fd296f 100644 --- a/src/test/correct/functions_with_params/clang_O2/functions_with_params.expected +++ b/src/test/correct/functions_with_params/clang_O2/functions_with_params.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1848bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/functions_with_params/clang_no_plt_no_pic/functions_with_params.expected b/src/test/correct/functions_with_params/clang_no_plt_no_pic/functions_with_params.expected index cc5c96c31..1136a902b 100644 --- a/src/test/correct/functions_with_params/clang_no_plt_no_pic/functions_with_params.expected +++ b/src/test/correct/functions_with_params/clang_no_plt_no_pic/functions_with_params.expected @@ -1,59 +1,59 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1912bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,9 +103,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -208,7 +208,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -227,7 +227,7 @@ procedure main() call plus_one(); goto l000009b1; l000009b1: - assume {:captureState "addr:l000009b1"} true; + assume {:captureState "l000009b1"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R0); assume {:captureState "%000009b7"} true; R0, Gamma_R0 := 0bv64, true; @@ -316,7 +316,7 @@ procedure plus_one() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lplus_one: - assume {:captureState "addr:lplus_one"} true; + assume {:captureState "lplus_one"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000997"} true; diff --git a/src/test/correct/functions_with_params/clang_pic/functions_with_params.expected b/src/test/correct/functions_with_params/clang_pic/functions_with_params.expected index cc5c96c31..1136a902b 100644 --- a/src/test/correct/functions_with_params/clang_pic/functions_with_params.expected +++ b/src/test/correct/functions_with_params/clang_pic/functions_with_params.expected @@ -1,59 +1,59 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1912bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,9 +103,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -208,7 +208,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -227,7 +227,7 @@ procedure main() call plus_one(); goto l000009b1; l000009b1: - assume {:captureState "addr:l000009b1"} true; + assume {:captureState "l000009b1"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R29, 18446744073709551612bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R29, 18446744073709551612bv64), Gamma_R0); assume {:captureState "%000009b7"} true; R0, Gamma_R0 := 0bv64, true; @@ -316,7 +316,7 @@ procedure plus_one() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lplus_one: - assume {:captureState "addr:lplus_one"} true; + assume {:captureState "lplus_one"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000997"} true; diff --git a/src/test/correct/functions_with_params/gcc/functions_with_params.expected b/src/test/correct/functions_with_params/gcc/functions_with_params.expected index e727d786d..284845f2f 100644 --- a/src/test/correct/functions_with_params/gcc/functions_with_params.expected +++ b/src/test/correct/functions_with_params/gcc/functions_with_params.expected @@ -1,57 +1,57 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1904bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,9 +101,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -204,7 +204,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%000002fc"} true; @@ -223,7 +223,7 @@ procedure main() call plus_one(); goto l0000035c; l0000035c: - assume {:captureState "addr:l0000035c"} true; + assume {:captureState "l0000035c"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); assume {:captureState "%00000362"} true; R0, Gamma_R0 := 0bv64, true; @@ -311,7 +311,7 @@ procedure plus_one() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lplus_one: - assume {:captureState "addr:lplus_one"} true; + assume {:captureState "lplus_one"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000342"} true; diff --git a/src/test/correct/functions_with_params/gcc_O2/functions_with_params.expected b/src/test/correct/functions_with_params/gcc_O2/functions_with_params.expected index b838106e7..031602cf6 100644 --- a/src/test/correct/functions_with_params/gcc_O2/functions_with_params.expected +++ b/src/test/correct/functions_with_params/gcc_O2/functions_with_params.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1916bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/functions_with_params/gcc_no_plt_no_pic/functions_with_params.expected b/src/test/correct/functions_with_params/gcc_no_plt_no_pic/functions_with_params.expected index b149ec3d5..03251913e 100644 --- a/src/test/correct/functions_with_params/gcc_no_plt_no_pic/functions_with_params.expected +++ b/src/test/correct/functions_with_params/gcc_no_plt_no_pic/functions_with_params.expected @@ -1,57 +1,57 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1904bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,9 +101,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -204,7 +204,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000933"} true; @@ -223,7 +223,7 @@ procedure main() call plus_one(); goto l00000993; l00000993: - assume {:captureState "addr:l00000993"} true; + assume {:captureState "l00000993"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); assume {:captureState "%00000999"} true; R0, Gamma_R0 := 0bv64, true; @@ -311,7 +311,7 @@ procedure plus_one() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lplus_one: - assume {:captureState "addr:lplus_one"} true; + assume {:captureState "lplus_one"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000979"} true; diff --git a/src/test/correct/functions_with_params/gcc_pic/functions_with_params.expected b/src/test/correct/functions_with_params/gcc_pic/functions_with_params.expected index b149ec3d5..03251913e 100644 --- a/src/test/correct/functions_with_params/gcc_pic/functions_with_params.expected +++ b/src/test/correct/functions_with_params/gcc_pic/functions_with_params.expected @@ -1,57 +1,57 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1904bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,7 +92,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,9 +101,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -204,7 +204,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000933"} true; @@ -223,7 +223,7 @@ procedure main() call plus_one(); goto l00000993; l00000993: - assume {:captureState "addr:l00000993"} true; + assume {:captureState "l00000993"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); assume {:captureState "%00000999"} true; R0, Gamma_R0 := 0bv64, true; @@ -311,7 +311,7 @@ procedure plus_one() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lplus_one: - assume {:captureState "addr:lplus_one"} true; + assume {:captureState "lplus_one"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000979"} true; diff --git a/src/test/correct/ifbranches/clang/ifbranches.expected b/src/test/correct/ifbranches/clang/ifbranches.expected index 2c08802aa..5718d9457 100644 --- a/src/test/correct/ifbranches/clang/ifbranches.expected +++ b/src/test/correct/ifbranches/clang/ifbranches.expected @@ -1,54 +1,54 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,9 +98,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -208,7 +208,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); assume {:captureState "%0000030d"} true; @@ -231,34 +231,37 @@ procedure main() } goto l0000034f; l0000034f: + assume {:captureState "l0000034f"} true; R8, Gamma_R8 := 1bv64, true; goto l00000352; l0000034c: + assume {:captureState "l0000034c"} true; R8, Gamma_R8 := 0bv64, true; goto l00000352; l00000352: + assume {:captureState "l00000352"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l0000035a; } goto l00000397; l0000035a: - assume {:captureState "addr:l0000035a"} true; + assume {:captureState "l0000035a"} true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); assume {:captureState "%0000036a"} true; goto l0000036d; l00000397: - assume {:captureState "addr:l00000397"} true; + assume {:captureState "l00000397"} true; goto l00000398; l00000398: - assume {:captureState "addr:l00000398"} true; + assume {:captureState "l00000398"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); assume {:captureState "%000003a6"} true; goto l0000036d; l0000036d: - assume {:captureState "addr:l0000036d"} true; + assume {:captureState "l0000036d"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); diff --git a/src/test/correct/ifbranches/clang_O2/ifbranches.expected b/src/test/correct/ifbranches/clang_O2/ifbranches.expected index 48ee466e2..e7d47e243 100644 --- a/src/test/correct/ifbranches/clang_O2/ifbranches.expected +++ b/src/test/correct/ifbranches/clang_O2/ifbranches.expected @@ -1,23 +1,23 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,7 +58,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -67,9 +67,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -175,7 +175,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 2bv64, true; #4, Gamma_#4 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#4, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#4); @@ -188,11 +188,14 @@ procedure main() } goto l000002df; l000002df: + assume {:captureState "l000002df"} true; R0, Gamma_R0 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; goto l000002e2; l000002db: + assume {:captureState "l000002db"} true; R0, Gamma_R0 := zero_extend32_32(R8[32:0]), Gamma_R8; goto l000002e2; l000002e2: + assume {:captureState "l000002e2"} true; return; } diff --git a/src/test/correct/ifbranches/clang_no_plt_no_pic/ifbranches.expected b/src/test/correct/ifbranches/clang_no_plt_no_pic/ifbranches.expected index e07f6572f..ed65fc303 100644 --- a/src/test/correct/ifbranches/clang_no_plt_no_pic/ifbranches.expected +++ b/src/test/correct/ifbranches/clang_no_plt_no_pic/ifbranches.expected @@ -1,54 +1,54 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,9 +98,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -208,7 +208,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); assume {:captureState "%00000979"} true; @@ -231,34 +231,37 @@ procedure main() } goto l000009bb; l000009bb: + assume {:captureState "l000009bb"} true; R8, Gamma_R8 := 1bv64, true; goto l000009be; l000009b8: + assume {:captureState "l000009b8"} true; R8, Gamma_R8 := 0bv64, true; goto l000009be; l000009be: + assume {:captureState "l000009be"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l000009c6; } goto l00000a03; l000009c6: - assume {:captureState "addr:l000009c6"} true; + assume {:captureState "l000009c6"} true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); assume {:captureState "%000009d6"} true; goto l000009d9; l00000a03: - assume {:captureState "addr:l00000a03"} true; + assume {:captureState "l00000a03"} true; goto l00000a04; l00000a04: - assume {:captureState "addr:l00000a04"} true; + assume {:captureState "l00000a04"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); assume {:captureState "%00000a12"} true; goto l000009d9; l000009d9: - assume {:captureState "addr:l000009d9"} true; + assume {:captureState "l000009d9"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); diff --git a/src/test/correct/ifbranches/clang_pic/ifbranches.expected b/src/test/correct/ifbranches/clang_pic/ifbranches.expected index e07f6572f..ed65fc303 100644 --- a/src/test/correct/ifbranches/clang_pic/ifbranches.expected +++ b/src/test/correct/ifbranches/clang_pic/ifbranches.expected @@ -1,54 +1,54 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,7 +89,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,9 +98,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -208,7 +208,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), true); assume {:captureState "%00000979"} true; @@ -231,34 +231,37 @@ procedure main() } goto l000009bb; l000009bb: + assume {:captureState "l000009bb"} true; R8, Gamma_R8 := 1bv64, true; goto l000009be; l000009b8: + assume {:captureState "l000009b8"} true; R8, Gamma_R8 := 0bv64, true; goto l000009be; l000009be: + assume {:captureState "l000009be"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l000009c6; } goto l00000a03; l000009c6: - assume {:captureState "addr:l000009c6"} true; + assume {:captureState "l000009c6"} true; R8, Gamma_R8 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); assume {:captureState "%000009d6"} true; goto l000009d9; l00000a03: - assume {:captureState "addr:l00000a03"} true; + assume {:captureState "l00000a03"} true; goto l00000a04; l00000a04: - assume {:captureState "addr:l00000a04"} true; + assume {:captureState "l00000a04"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); assume {:captureState "%00000a12"} true; goto l000009d9; l000009d9: - assume {:captureState "addr:l000009d9"} true; + assume {:captureState "l000009d9"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R8, Gamma_R8 := zero_extend32_32(bvadd32(R8[32:0], 1bv32)), Gamma_R8; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); diff --git a/src/test/correct/ifbranches/gcc/ifbranches.expected b/src/test/correct/ifbranches/gcc/ifbranches.expected index a81f98949..5208e2068 100644 --- a/src/test/correct/ifbranches/gcc/ifbranches.expected +++ b/src/test/correct/ifbranches/gcc/ifbranches.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,9 +96,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -206,7 +206,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000002fe"} true; @@ -226,19 +226,19 @@ procedure main() } goto l00000369; l00000330: - assume {:captureState "addr:l00000330"} true; + assume {:captureState "l00000330"} true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); assume {:captureState "%00000340"} true; goto l00000342; l00000369: - assume {:captureState "addr:l00000369"} true; + assume {:captureState "l00000369"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); assume {:captureState "%00000374"} true; goto l00000342; l00000342: - assume {:captureState "addr:l00000342"} true; + assume {:captureState "l00000342"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 1bv32)), Gamma_R0; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); diff --git a/src/test/correct/ifbranches/gcc_O2/ifbranches.expected b/src/test/correct/ifbranches/gcc_O2/ifbranches.expected index abe702918..f67aba3a9 100644 --- a/src/test/correct/ifbranches/gcc_O2/ifbranches.expected +++ b/src/test/correct/ifbranches/gcc_O2/ifbranches.expected @@ -1,21 +1,21 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} mem: [bv64]bv8; +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,7 +56,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -65,9 +65,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -173,7 +173,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #1, Gamma_#1 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#1, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#1); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#1, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967296bv33))), (Gamma_R0 && Gamma_#1); @@ -185,12 +185,15 @@ procedure main() } goto l000001c6; l000001c6: + assume {:captureState "l000001c6"} true; R0, Gamma_R0 := 1bv64, true; goto l000001c9; l000001c3: + assume {:captureState "l000001c3"} true; R0, Gamma_R0 := 0bv64, true; goto l000001c9; l000001c9: + assume {:captureState "l000001c9"} true; R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 2bv32)), Gamma_R0; return; } diff --git a/src/test/correct/ifbranches/gcc_no_plt_no_pic/ifbranches.expected b/src/test/correct/ifbranches/gcc_no_plt_no_pic/ifbranches.expected index 370e57676..9902018f0 100644 --- a/src/test/correct/ifbranches/gcc_no_plt_no_pic/ifbranches.expected +++ b/src/test/correct/ifbranches/gcc_no_plt_no_pic/ifbranches.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,9 +96,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -206,7 +206,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000931"} true; @@ -226,19 +226,19 @@ procedure main() } goto l0000099c; l00000963: - assume {:captureState "addr:l00000963"} true; + assume {:captureState "l00000963"} true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); assume {:captureState "%00000973"} true; goto l00000975; l0000099c: - assume {:captureState "addr:l0000099c"} true; + assume {:captureState "l0000099c"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); assume {:captureState "%000009a7"} true; goto l00000975; l00000975: - assume {:captureState "addr:l00000975"} true; + assume {:captureState "l00000975"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 1bv32)), Gamma_R0; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); diff --git a/src/test/correct/ifbranches/gcc_pic/ifbranches.expected b/src/test/correct/ifbranches/gcc_pic/ifbranches.expected index 370e57676..9902018f0 100644 --- a/src/test/correct/ifbranches/gcc_pic/ifbranches.expected +++ b/src/test/correct/ifbranches/gcc_pic/ifbranches.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,9 +96,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -206,7 +206,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000931"} true; @@ -226,19 +226,19 @@ procedure main() } goto l0000099c; l00000963: - assume {:captureState "addr:l00000963"} true; + assume {:captureState "l00000963"} true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); assume {:captureState "%00000973"} true; goto l00000975; l0000099c: - assume {:captureState "addr:l0000099c"} true; + assume {:captureState "l0000099c"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 24bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); assume {:captureState "%000009a7"} true; goto l00000975; l00000975: - assume {:captureState "addr:l00000975"} true; + assume {:captureState "l00000975"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 24bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 24bv64)); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 1bv32)), Gamma_R0; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); diff --git a/src/test/correct/ifglobal/clang/ifglobal.expected b/src/test/correct/ifglobal/clang/ifglobal.expected index c194aad54..f6cda1c81 100644 --- a/src/test/correct/ifglobal/clang/ifglobal.expected +++ b/src/test/correct/ifglobal/clang/ifglobal.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,9 +96,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -205,7 +205,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000002f1"} true; @@ -224,22 +224,25 @@ procedure main() } goto l00000321; l00000321: + assume {:captureState "l00000321"} true; R8, Gamma_R8 := 1bv64, true; goto l00000324; l0000031e: + assume {:captureState "l0000031e"} true; R8, Gamma_R8 := 0bv64, true; goto l00000324; l00000324: + assume {:captureState "l00000324"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l0000032c; } goto l00000343; l00000343: - assume {:captureState "addr:l00000343"} true; + assume {:captureState "l00000343"} true; goto l00000344; l00000344: - assume {:captureState "addr:l00000344"} true; + assume {:captureState "l00000344"} true; R8, Gamma_R8 := 1bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); @@ -248,7 +251,7 @@ procedure main() assume {:captureState "%00000357"} true; goto l0000032c; l0000032c: - assume {:captureState "addr:l0000032c"} true; + assume {:captureState "l0000032c"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/ifglobal/clang_O2/ifglobal.expected b/src/test/correct/ifglobal/clang_O2/ifglobal.expected index 73ffd077a..afe71ccd1 100644 --- a/src/test/correct/ifglobal/clang_O2/ifglobal.expected +++ b/src/test/correct/ifglobal/clang_O2/ifglobal.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,9 +85,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -192,7 +192,7 @@ procedure main() } goto l000002f8; l000002dc: - assume {:captureState "addr:l000002dc"} true; + assume {:captureState "l000002dc"} true; R9, Gamma_R9 := 1bv64, true; call rely(); assert (L(mem, bvadd64(R8, 52bv64)) ==> Gamma_R9); @@ -201,7 +201,7 @@ procedure main() R0, Gamma_R0 := 0bv64, true; return; l000002f8: - assume {:captureState "addr:l000002f8"} true; + assume {:captureState "l000002f8"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/ifglobal/clang_no_plt_no_pic/ifglobal.expected b/src/test/correct/ifglobal/clang_no_plt_no_pic/ifglobal.expected index e2441dabc..b07e23d00 100644 --- a/src/test/correct/ifglobal/clang_no_plt_no_pic/ifglobal.expected +++ b/src/test/correct/ifglobal/clang_no_plt_no_pic/ifglobal.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -96,9 +96,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -205,7 +205,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000900"} true; @@ -224,22 +224,25 @@ procedure main() } goto l00000930; l00000930: + assume {:captureState "l00000930"} true; R8, Gamma_R8 := 1bv64, true; goto l00000933; l0000092d: + assume {:captureState "l0000092d"} true; R8, Gamma_R8 := 0bv64, true; goto l00000933; l00000933: + assume {:captureState "l00000933"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l0000093b; } goto l00000952; l00000952: - assume {:captureState "addr:l00000952"} true; + assume {:captureState "l00000952"} true; goto l00000953; l00000953: - assume {:captureState "addr:l00000953"} true; + assume {:captureState "l00000953"} true; R8, Gamma_R8 := 1bv64, true; R9, Gamma_R9 := 69632bv64, true; call rely(); @@ -248,7 +251,7 @@ procedure main() assume {:captureState "%00000966"} true; goto l0000093b; l0000093b: - assume {:captureState "addr:l0000093b"} true; + assume {:captureState "l0000093b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/ifglobal/clang_pic/ifglobal.expected b/src/test/correct/ifglobal/clang_pic/ifglobal.expected index f939c757e..dfb965c3c 100644 --- a/src/test/correct/ifglobal/clang_pic/ifglobal.expected +++ b/src/test/correct/ifglobal/clang_pic/ifglobal.expected @@ -1,60 +1,60 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,7 +103,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -112,9 +112,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -237,7 +237,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000002f9"} true; @@ -258,22 +258,25 @@ procedure main() } goto l00000330; l00000330: + assume {:captureState "l00000330"} true; R8, Gamma_R8 := 1bv64, true; goto l00000333; l0000032d: + assume {:captureState "l0000032d"} true; R8, Gamma_R8 := 0bv64, true; goto l00000333; l00000333: + assume {:captureState "l00000333"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l0000033b; } goto l00000352; l00000352: - assume {:captureState "addr:l00000352"} true; + assume {:captureState "l00000352"} true; goto l00000353; l00000353: - assume {:captureState "addr:l00000353"} true; + assume {:captureState "l00000353"} true; R8, Gamma_R8 := 1bv64, true; R9, Gamma_R9 := 65536bv64, true; call rely(); @@ -284,7 +287,7 @@ procedure main() assume {:captureState "%0000036d"} true; goto l0000033b; l0000033b: - assume {:captureState "addr:l0000033b"} true; + assume {:captureState "l0000033b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/ifglobal/gcc/ifglobal.expected b/src/test/correct/ifglobal/gcc/ifglobal.expected index 3cc4ec57f..d23d1d5bf 100644 --- a/src/test/correct/ifglobal/gcc/ifglobal.expected +++ b/src/test/correct/ifglobal/gcc/ifglobal.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -197,7 +197,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -213,7 +213,7 @@ procedure main() } goto l00000311; l00000311: - assume {:captureState "addr:l00000311"} true; + assume {:captureState "l00000311"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -223,7 +223,7 @@ procedure main() assume {:captureState "%00000327"} true; goto l00000302; l00000302: - assume {:captureState "addr:l00000302"} true; + assume {:captureState "l00000302"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/ifglobal/gcc_O2/ifglobal.expected b/src/test/correct/ifglobal/gcc_O2/ifglobal.expected index 7fc29b6d1..7c637d172 100644 --- a/src/test/correct/ifglobal/gcc_O2/ifglobal.expected +++ b/src/test/correct/ifglobal/gcc_O2/ifglobal.expected @@ -1,40 +1,40 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,9 +84,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -181,7 +181,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, bvadd64(R0, 20bv64))), (gamma_load32(Gamma_mem, bvadd64(R0, 20bv64)) || L(mem, bvadd64(R0, 20bv64))); @@ -191,7 +191,7 @@ procedure main() } goto l00000396; l00000396: - assume {:captureState "addr:l00000396"} true; + assume {:captureState "l00000396"} true; R1, Gamma_R1 := 1bv64, true; call rely(); assert (L(mem, bvadd64(R0, 20bv64)) ==> Gamma_R1); @@ -199,7 +199,7 @@ procedure main() assume {:captureState "%000003a1"} true; goto l000001b7; l000001b7: - assume {:captureState "addr:l000001b7"} true; + assume {:captureState "l000001b7"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/ifglobal/gcc_no_plt_no_pic/ifglobal.expected b/src/test/correct/ifglobal/gcc_no_plt_no_pic/ifglobal.expected index a594b4954..77b0fdc9a 100644 --- a/src/test/correct/ifglobal/gcc_no_plt_no_pic/ifglobal.expected +++ b/src/test/correct/ifglobal/gcc_no_plt_no_pic/ifglobal.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -197,7 +197,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -213,7 +213,7 @@ procedure main() } goto l000008e5; l000008e5: - assume {:captureState "addr:l000008e5"} true; + assume {:captureState "l000008e5"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; @@ -223,7 +223,7 @@ procedure main() assume {:captureState "%000008fb"} true; goto l000008d6; l000008d6: - assume {:captureState "addr:l000008d6"} true; + assume {:captureState "l000008d6"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/ifglobal/gcc_pic/ifglobal.expected b/src/test/correct/ifglobal/gcc_pic/ifglobal.expected index e39101a09..a9559c8a6 100644 --- a/src/test/correct/ifglobal/gcc_pic/ifglobal.expected +++ b/src/test/correct/ifglobal/gcc_pic/ifglobal.expected @@ -1,54 +1,54 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $x_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,9 +106,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -229,7 +229,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -246,7 +246,7 @@ procedure main() } goto l00000312; l00000312: - assume {:captureState "addr:l00000312"} true; + assume {:captureState "l00000312"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -257,7 +257,7 @@ procedure main() assume {:captureState "%00000329"} true; goto l00000303; l00000303: - assume {:captureState "addr:l00000303"} true; + assume {:captureState "l00000303"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/indirect_call/clang_O2/indirect_call.expected b/src/test/correct/indirect_call/clang_O2/indirect_call.expected index 101f70559..d04773ed9 100644 --- a/src/test/correct/indirect_call/clang_O2/indirect_call.expected +++ b/src/test/correct/indirect_call/clang_O2/indirect_call.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1952bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -120,7 +120,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -129,9 +129,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -316,7 +316,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%000002fc"} true; @@ -330,14 +330,14 @@ procedure main() call puts(); goto l00000320; l00000320: - assume {:captureState "addr:l00000320"} true; + assume {:captureState "l00000320"} true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 1956bv64), Gamma_R0; R30, Gamma_R30 := 1920bv64, true; call puts(); goto l00000332; l00000332: - assume {:captureState "addr:l00000332"} true; + assume {:captureState "l00000332"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/indirect_call/gcc_O2/indirect_call.expected b/src/test/correct/indirect_call/gcc_O2/indirect_call.expected index 4439316c5..992bdfc81 100644 --- a/src/test/correct/indirect_call/gcc_O2/indirect_call.expected +++ b/src/test/correct/indirect_call/gcc_O2/indirect_call.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1984bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -126,7 +126,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -135,9 +135,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure greet() @@ -312,7 +312,7 @@ procedure greet() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lgreet: - assume {:captureState "addr:lgreet"} true; + assume {:captureState "lgreet"} true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 1992bv64), Gamma_R0; call puts(); @@ -514,7 +514,7 @@ procedure main() var #1: bv64; var Gamma_#1: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); assume {:captureState "%000001ca"} true; @@ -528,12 +528,12 @@ procedure main() call puts(); goto l000001ef; l000001ef: - assume {:captureState "addr:l000001ef"} true; + assume {:captureState "l000001ef"} true; R30, Gamma_R30 := 1624bv64, true; call greet(); goto l00000205; l00000205: - assume {:captureState "addr:l00000205"} true; + assume {:captureState "l00000205"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/initialisation/clang/initialisation.expected b/src/test/correct/initialisation/clang/initialisation.expected index 4865cfdd4..4a8b8a7ad 100644 --- a/src/test/correct/initialisation/clang/initialisation.expected +++ b/src/test/correct/initialisation/clang/initialisation.expected @@ -1,86 +1,86 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R11: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R11: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $a_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R11: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R11: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $a_addr: bv64; axiom ($a_addr == 69696bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69680bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69684bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd65(bv65, bv65) returns (bv65); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp64(bv64, bv64) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp65(bv65, bv65) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvadd"} bvadd65(bv65, bv65) returns (bv65); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp64(bv64, bv64) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp65(bv65, bv65) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_64(bv64) returns (bv65); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_64(bv64) returns (bv65); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_64(bv64) returns (bv65); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_64(bv64) returns (bv65); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -121,7 +121,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -130,9 +130,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -264,7 +264,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; R9, Gamma_R9 := bvadd64(R9, 64bv64), Gamma_R9; diff --git a/src/test/correct/initialisation/clang_O2/initialisation.expected b/src/test/correct/initialisation/clang_O2/initialisation.expected index d85e30aaf..5bbd94028 100644 --- a/src/test/correct/initialisation/clang_O2/initialisation.expected +++ b/src/test/correct/initialisation/clang_O2/initialisation.expected @@ -1,88 +1,88 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R11: bool; -var {:extern } Gamma_R12: bool; -var {:extern } Gamma_R13: bool; -var {:extern } Gamma_R14: bool; -var {:extern } Gamma_R15: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R11: bv64; -var {:extern } R12: bv64; -var {:extern } R13: bv64; -var {:extern } R14: bv64; -var {:extern } R15: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $a_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R11: bool; +var {:extern} Gamma_R12: bool; +var {:extern} Gamma_R13: bool; +var {:extern} Gamma_R14: bool; +var {:extern} Gamma_R15: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R11: bv64; +var {:extern} R12: bv64; +var {:extern} R13: bv64; +var {:extern} R14: bv64; +var {:extern} R15: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $a_addr: bv64; axiom ($a_addr == 69696bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69680bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69684bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -123,7 +123,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -132,9 +132,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -256,7 +256,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R10, Gamma_R10 := 69632bv64, true; R10, Gamma_R10 := bvadd64(R10, 64bv64), Gamma_R10; R8, Gamma_R8 := 69632bv64, true; diff --git a/src/test/correct/initialisation/clang_no_plt_no_pic/initialisation.expected b/src/test/correct/initialisation/clang_no_plt_no_pic/initialisation.expected index cb1eb0d81..2487e0171 100644 --- a/src/test/correct/initialisation/clang_no_plt_no_pic/initialisation.expected +++ b/src/test/correct/initialisation/clang_no_plt_no_pic/initialisation.expected @@ -1,86 +1,86 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R11: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R11: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $a_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R11: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R11: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $a_addr: bv64; axiom ($a_addr == 69696bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69680bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69684bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd65(bv65, bv65) returns (bv65); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp64(bv64, bv64) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp65(bv65, bv65) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvadd"} bvadd65(bv65, bv65) returns (bv65); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp64(bv64, bv64) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp65(bv65, bv65) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_64(bv64) returns (bv65); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_64(bv64) returns (bv65); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_64(bv64) returns (bv65); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_64(bv64) returns (bv65); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -121,7 +121,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -130,9 +130,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -264,7 +264,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; R9, Gamma_R9 := bvadd64(R9, 64bv64), Gamma_R9; diff --git a/src/test/correct/initialisation/clang_pic/initialisation.expected b/src/test/correct/initialisation/clang_pic/initialisation.expected index eaefa7a71..6fb983d9b 100644 --- a/src/test/correct/initialisation/clang_pic/initialisation.expected +++ b/src/test/correct/initialisation/clang_pic/initialisation.expected @@ -1,84 +1,84 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $a_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $a_addr: bv64; axiom ($a_addr == 69696bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69680bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69684bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd65(bv65, bv65) returns (bv65); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp64(bv64, bv64) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp65(bv65, bv65) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvadd"} bvadd65(bv65, bv65) returns (bv65); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp64(bv64, bv64) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp65(bv65, bv65) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_64(bv64) returns (bv65); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_64(bv64) returns (bv65); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_64(bv64) returns (bv65); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_64(bv64) returns (bv65); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -151,7 +151,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69566bv64) == 0bv8); free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -160,9 +160,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -358,7 +358,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); diff --git a/src/test/correct/initialisation/gcc/initialisation.expected b/src/test/correct/initialisation/gcc/initialisation.expected index e0bc5e761..cd8f95208 100644 --- a/src/test/correct/initialisation/gcc/initialisation.expected +++ b/src/test/correct/initialisation/gcc/initialisation.expected @@ -1,74 +1,74 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $a_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $a_addr: bv64; axiom ($a_addr == 69664bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69648bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,7 +109,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -118,9 +118,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -242,7 +242,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); diff --git a/src/test/correct/initialisation/gcc_O2/initialisation.expected b/src/test/correct/initialisation/gcc_O2/initialisation.expected index c9efe3b33..0b0da4f5d 100644 --- a/src/test/correct/initialisation/gcc_O2/initialisation.expected +++ b/src/test/correct/initialisation/gcc_O2/initialisation.expected @@ -1,84 +1,84 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R3: bool; -var {:extern } Gamma_R4: bool; -var {:extern } Gamma_R5: bool; -var {:extern } Gamma_R6: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R3: bv64; -var {:extern } R4: bv64; -var {:extern } R5: bv64; -var {:extern } R6: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $a_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R3: bool; +var {:extern} Gamma_R4: bool; +var {:extern} Gamma_R5: bool; +var {:extern} Gamma_R6: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} R3: bv64; +var {:extern} R4: bv64; +var {:extern} R5: bv64; +var {:extern} R6: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $a_addr: bv64; axiom ($a_addr == 69664bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69648bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69672bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -119,7 +119,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -128,9 +128,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -253,7 +253,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R5, Gamma_R5 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R5, 16bv64), Gamma_R5; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/initialisation/gcc_no_plt_no_pic/initialisation.expected b/src/test/correct/initialisation/gcc_no_plt_no_pic/initialisation.expected index d3f07b396..418adaae6 100644 --- a/src/test/correct/initialisation/gcc_no_plt_no_pic/initialisation.expected +++ b/src/test/correct/initialisation/gcc_no_plt_no_pic/initialisation.expected @@ -1,74 +1,74 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $a_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $a_addr: bv64; axiom ($a_addr == 69664bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69648bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,7 +109,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -118,9 +118,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -242,7 +242,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); diff --git a/src/test/correct/initialisation/gcc_pic/initialisation.expected b/src/test/correct/initialisation/gcc_pic/initialisation.expected index c0c85331e..4f95961a3 100644 --- a/src/test/correct/initialisation/gcc_pic/initialisation.expected +++ b/src/test/correct/initialisation/gcc_pic/initialisation.expected @@ -1,74 +1,74 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $a_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $a_addr: bv64; axiom ($a_addr == 69664bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69648bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -141,7 +141,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -150,9 +150,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -338,7 +338,7 @@ procedure main() free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4048bv64)) || L(mem, bvadd64(R0, 4048bv64))); diff --git a/src/test/correct/jumptable/clang_O2/jumptable.expected b/src/test/correct/jumptable/clang_O2/jumptable.expected index 467d96736..8de643ece 100644 --- a/src/test/correct/jumptable/clang_O2/jumptable.expected +++ b/src/test/correct/jumptable/clang_O2/jumptable.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1916bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69680bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -78,7 +78,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,9 +87,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -188,7 +188,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); diff --git a/src/test/correct/jumptable/gcc_O2/jumptable.expected b/src/test/correct/jumptable/gcc_O2/jumptable.expected index 47773b7fd..0b02b32d3 100644 --- a/src/test/correct/jumptable/gcc_O2/jumptable.expected +++ b/src/test/correct/jumptable/gcc_O2/jumptable.expected @@ -1,65 +1,65 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1976bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69648bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,7 +100,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,9 +109,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure add_six() @@ -190,7 +190,7 @@ procedure add_six() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { ladd_six: - assume {:captureState "addr:ladd_six"} true; + assume {:captureState "ladd_six"} true; R1, Gamma_R1 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); @@ -278,7 +278,7 @@ procedure add_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { ladd_two: - assume {:captureState "addr:ladd_two"} true; + assume {:captureState "ladd_two"} true; R1, Gamma_R1 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); @@ -392,7 +392,7 @@ procedure main() var #1: bv64; var Gamma_#1: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); assume {:captureState "%00000202"} true; @@ -404,17 +404,17 @@ procedure main() call add_two(); goto l0000027c; l0000027c: - assume {:captureState "addr:l0000027c"} true; + assume {:captureState "l0000027c"} true; R30, Gamma_R30 := 1552bv64, true; call add_six(); goto l00000283; l00000283: - assume {:captureState "addr:l00000283"} true; + assume {:captureState "l00000283"} true; R30, Gamma_R30 := 1556bv64, true; call sub_seven(); goto l0000028a; l0000028a: - assume {:captureState "addr:l0000028a"} true; + assume {:captureState "l0000028a"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -498,7 +498,7 @@ procedure sub_seven() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lsub_seven: - assume {:captureState "addr:lsub_seven"} true; + assume {:captureState "lsub_seven"} true; R1, Gamma_R1 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); diff --git a/src/test/correct/jumptable3/gcc/jumptable3.expected b/src/test/correct/jumptable3/gcc/jumptable3.expected index bb2282634..d5441c22d 100644 --- a/src/test/correct/jumptable3/gcc/jumptable3.expected +++ b/src/test/correct/jumptable3/gcc/jumptable3.expected @@ -1,69 +1,69 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -104,7 +104,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -113,9 +113,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure add_six() @@ -194,7 +194,7 @@ procedure add_six() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { ladd_six: - assume {:captureState "addr:ladd_six"} true; + assume {:captureState "ladd_six"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -285,7 +285,7 @@ procedure add_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { ladd_two: - assume {:captureState "addr:ladd_two"} true; + assume {:captureState "ladd_two"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -455,7 +455,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000556"} true; @@ -479,7 +479,7 @@ procedure main() } goto l000005e0; l000005e0: - assume {:captureState "addr:l000005e0"} true; + assume {:captureState "l000005e0"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967284bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934581bv33))), (Gamma_R0 && Gamma_#6); @@ -492,7 +492,7 @@ procedure main() } goto l00000608; l00000608: - assume {:captureState "addr:l00000608"} true; + assume {:captureState "l00000608"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #7, Gamma_#7 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#7); @@ -505,35 +505,35 @@ procedure main() } goto l00000643; l00000629: - assume {:captureState "addr:l00000629"} true; + assume {:captureState "l00000629"} true; R30, Gamma_R30 := 2288bv64, true; call sub_seven(); goto l00000635; l00000635: - assume {:captureState "addr:l00000635"} true; + assume {:captureState "l00000635"} true; R30, Gamma_R30 := 2292bv64, true; call add_two(); goto l0000063c; l0000063c: - assume {:captureState "addr:l0000063c"} true; + assume {:captureState "l0000063c"} true; R30, Gamma_R30 := 2296bv64, true; call add_six(); goto l00000599; l00000599: - assume {:captureState "addr:l00000599"} true; + assume {:captureState "l00000599"} true; R30, Gamma_R30 := 2300bv64, true; call sub_seven(); goto l000005a5; l000005a5: - assume {:captureState "addr:l000005a5"} true; + assume {:captureState "l000005a5"} true; R30, Gamma_R30 := 2304bv64, true; call add_two(); goto l000005ac; l000005ac: - assume {:captureState "addr:l000005ac"} true; + assume {:captureState "l000005ac"} true; goto l000005ad; l00000643: - assume {:captureState "addr:l00000643"} true; + assume {:captureState "l00000643"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #8, Gamma_#8 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#8); @@ -546,7 +546,7 @@ procedure main() } goto l0000066b; l0000066b: - assume {:captureState "addr:l0000066b"} true; + assume {:captureState "l0000066b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #9, Gamma_#9 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#9); @@ -559,20 +559,20 @@ procedure main() } goto l000006a3; l0000068c: - assume {:captureState "addr:l0000068c"} true; + assume {:captureState "l0000068c"} true; R30, Gamma_R30 := 2276bv64, true; call add_two(); goto l00000698; l00000698: - assume {:captureState "addr:l00000698"} true; + assume {:captureState "l00000698"} true; R30, Gamma_R30 := 2280bv64, true; call add_six(); goto l0000069f; l0000069f: - assume {:captureState "addr:l0000069f"} true; + assume {:captureState "l0000069f"} true; goto l000005ad; l000006a3: - assume {:captureState "addr:l000006a3"} true; + assume {:captureState "l000006a3"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #10, Gamma_#10 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#10); @@ -585,7 +585,7 @@ procedure main() } goto l000006cb; l000006cb: - assume {:captureState "addr:l000006cb"} true; + assume {:captureState "l000006cb"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #11, Gamma_#11 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#11); @@ -598,7 +598,7 @@ procedure main() } goto l00000703; l00000703: - assume {:captureState "addr:l00000703"} true; + assume {:captureState "l00000703"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #12, Gamma_#12 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#12); @@ -611,7 +611,7 @@ procedure main() } goto l0000072b; l0000072b: - assume {:captureState "addr:l0000072b"} true; + assume {:captureState "l0000072b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #13, Gamma_#13 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#13, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#13); @@ -624,7 +624,7 @@ procedure main() } goto l00000758; l00000758: - assume {:captureState "addr:l00000758"} true; + assume {:captureState "l00000758"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #14, Gamma_#14 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#14, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#14); @@ -637,7 +637,7 @@ procedure main() } goto l00000780; l00000780: - assume {:captureState "addr:l00000780"} true; + assume {:captureState "l00000780"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #15, Gamma_#15 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#15, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#15); @@ -650,7 +650,7 @@ procedure main() } goto l000007ad; l000007ad: - assume {:captureState "addr:l000007ad"} true; + assume {:captureState "l000007ad"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #16, Gamma_#16 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#16, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#16); @@ -663,7 +663,7 @@ procedure main() } goto l000007d5; l000007d5: - assume {:captureState "addr:l000007d5"} true; + assume {:captureState "l000007d5"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #17, Gamma_#17 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#17, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#17); @@ -676,40 +676,40 @@ procedure main() } goto l00000809; l000007f6: - assume {:captureState "addr:l000007f6"} true; + assume {:captureState "l000007f6"} true; R30, Gamma_R30 := 2248bv64, true; call add_six(); goto l00000802; l00000802: - assume {:captureState "addr:l00000802"} true; + assume {:captureState "l00000802"} true; R30, Gamma_R30 := 2252bv64, true; call add_two(); goto l000007a1; l000007a1: - assume {:captureState "addr:l000007a1"} true; + assume {:captureState "l000007a1"} true; R30, Gamma_R30 := 2256bv64, true; call add_six(); goto l0000074c; l0000074c: - assume {:captureState "addr:l0000074c"} true; + assume {:captureState "l0000074c"} true; R30, Gamma_R30 := 2260bv64, true; call sub_seven(); goto l000006ec; l000006ec: - assume {:captureState "addr:l000006ec"} true; + assume {:captureState "l000006ec"} true; R30, Gamma_R30 := 2264bv64, true; call sub_seven(); goto l000006f8; l000006f8: - assume {:captureState "addr:l000006f8"} true; + assume {:captureState "l000006f8"} true; R30, Gamma_R30 := 2268bv64, true; call add_six(); goto l000006ff; l000006ff: - assume {:captureState "addr:l000006ff"} true; + assume {:captureState "l000006ff"} true; goto l000005ad; l00000809: - assume {:captureState "addr:l00000809"} true; + assume {:captureState "l00000809"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #18, Gamma_#18 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#18, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#18); @@ -722,7 +722,7 @@ procedure main() } goto l00000831; l00000831: - assume {:captureState "addr:l00000831"} true; + assume {:captureState "l00000831"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #19, Gamma_#19 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#19, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#19); @@ -735,15 +735,15 @@ procedure main() } goto l00000862; l00000852: - assume {:captureState "addr:l00000852"} true; + assume {:captureState "l00000852"} true; R30, Gamma_R30 := 2240bv64, true; call add_six(); goto l0000085e; l0000085e: - assume {:captureState "addr:l0000085e"} true; + assume {:captureState "l0000085e"} true; goto l000005ad; l00000862: - assume {:captureState "addr:l00000862"} true; + assume {:captureState "l00000862"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #20, Gamma_#20 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#20, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#20); @@ -756,7 +756,7 @@ procedure main() } goto l0000088a; l0000088a: - assume {:captureState "addr:l0000088a"} true; + assume {:captureState "l0000088a"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #21, Gamma_#21 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#21, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#21); @@ -769,20 +769,20 @@ procedure main() } goto l000008c2; l000008ab: - assume {:captureState "addr:l000008ab"} true; + assume {:captureState "l000008ab"} true; R30, Gamma_R30 := 2228bv64, true; call add_two(); goto l000008b7; l000008b7: - assume {:captureState "addr:l000008b7"} true; + assume {:captureState "l000008b7"} true; R30, Gamma_R30 := 2232bv64, true; call sub_seven(); goto l000008be; l000008be: - assume {:captureState "addr:l000008be"} true; + assume {:captureState "l000008be"} true; goto l000005ad; l000008c2: - assume {:captureState "addr:l000008c2"} true; + assume {:captureState "l000008c2"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #22, Gamma_#22 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#22, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#22); @@ -795,7 +795,7 @@ procedure main() } goto l000008ea; l000008ea: - assume {:captureState "addr:l000008ea"} true; + assume {:captureState "l000008ea"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #23, Gamma_#23 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#23, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#23); @@ -808,7 +808,7 @@ procedure main() } goto l0000091b; l0000091b: - assume {:captureState "addr:l0000091b"} true; + assume {:captureState "l0000091b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #24, Gamma_#24 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#24, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#24); @@ -821,7 +821,7 @@ procedure main() } goto l00000943; l00000943: - assume {:captureState "addr:l00000943"} true; + assume {:captureState "l00000943"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #25, Gamma_#25 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#25, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#25); @@ -834,15 +834,15 @@ procedure main() } goto l0000097b; l00000964: - assume {:captureState "addr:l00000964"} true; + assume {:captureState "l00000964"} true; R30, Gamma_R30 := 2208bv64, true; call add_two(); goto l00000970; l00000970: - assume {:captureState "addr:l00000970"} true; + assume {:captureState "l00000970"} true; goto l000005ad; l0000097b: - assume {:captureState "addr:l0000097b"} true; + assume {:captureState "l0000097b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #26, Gamma_#26 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#26, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#26); @@ -855,34 +855,34 @@ procedure main() } goto l000009a1; l00000974: - assume {:captureState "addr:l00000974"} true; + assume {:captureState "l00000974"} true; R30, Gamma_R30 := 2216bv64, true; call add_six(); goto l0000090b; l0000090b: - assume {:captureState "addr:l0000090b"} true; + assume {:captureState "l0000090b"} true; R30, Gamma_R30 := 2220bv64, true; call sub_seven(); goto l00000917; l00000917: - assume {:captureState "addr:l00000917"} true; + assume {:captureState "l00000917"} true; goto l000005ad; l000005ad: - assume {:captureState "addr:l000005ad"} true; + assume {:captureState "l000005ad"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); goto l000005c2; l000009a1: - assume {:captureState "addr:l000009a1"} true; + assume {:captureState "l000009a1"} true; goto l000005d7; l000005d7: - assume {:captureState "addr:l000005d7"} true; + assume {:captureState "l000005d7"} true; R0, Gamma_R0 := 1bv64, true; goto l000005c2; l000005c2: - assume {:captureState "addr:l000005c2"} true; + assume {:captureState "l000005c2"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; @@ -965,7 +965,7 @@ procedure sub_seven() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lsub_seven: - assume {:captureState "addr:lsub_seven"} true; + assume {:captureState "lsub_seven"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); diff --git a/src/test/correct/jumptable3/gcc_O2/jumptable3.expected b/src/test/correct/jumptable3/gcc_O2/jumptable3.expected index 12f14eba8..ba99b9e81 100644 --- a/src/test/correct/jumptable3/gcc_O2/jumptable3.expected +++ b/src/test/correct/jumptable3/gcc_O2/jumptable3.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -80,7 +80,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -89,9 +89,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -219,7 +219,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; #1, Gamma_#1 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#1, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#1); @@ -232,14 +232,14 @@ procedure main() } goto l00000753; l00000753: - assume {:captureState "addr:l00000753"} true; + assume {:captureState "l00000753"} true; assert (Gamma_ZF && (Gamma_VF && Gamma_NF)); if ((bvand1(bvcomp1(NF, VF), bvcomp1(ZF, 0bv1)) != 0bv1)) { goto l000006e8; } goto l0000075c; l000006e8: - assume {:captureState "addr:l000006e8"} true; + assume {:captureState "l000006e8"} true; R1, Gamma_R1 := 69632bv64, true; #8, Gamma_#8 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#8); @@ -252,7 +252,7 @@ procedure main() } goto l0000070c; l000005f9: - assume {:captureState "addr:l000005f9"} true; + assume {:captureState "l000005f9"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 8bv32)), Gamma_R0; @@ -262,14 +262,14 @@ procedure main() assume {:captureState "%0000060c"} true; goto l00000360; l0000070c: - assume {:captureState "addr:l0000070c"} true; + assume {:captureState "l0000070c"} true; assert (Gamma_ZF && (Gamma_VF && Gamma_NF)); if ((bvnot1(bvand1(bvcomp1(NF, VF), bvcomp1(ZF, 0bv1))) != 0bv1)) { goto l00000644; } goto l00000715; l00000644: - assume {:captureState "addr:l00000644"} true; + assume {:captureState "l00000644"} true; #6, Gamma_#6 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#6); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#6, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967289bv33))), (Gamma_R0 && Gamma_#6); @@ -281,7 +281,7 @@ procedure main() } goto l00000663; l00000663: - assume {:captureState "addr:l00000663"} true; + assume {:captureState "l00000663"} true; #7, Gamma_#7 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#7); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#7, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967288bv33))), (Gamma_R0 && Gamma_#7); @@ -293,7 +293,7 @@ procedure main() } goto l00000347; l00000715: - assume {:captureState "addr:l00000715"} true; + assume {:captureState "l00000715"} true; #9, Gamma_#9 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#9); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#9, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967286bv33))), (Gamma_R0 && Gamma_#9); @@ -305,7 +305,7 @@ procedure main() } goto l00000734; l00000612: - assume {:captureState "addr:l00000612"} true; + assume {:captureState "l00000612"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 1bv32)), Gamma_R0; @@ -315,7 +315,7 @@ procedure main() assume {:captureState "%00000625"} true; goto l00000628; l00000734: - assume {:captureState "addr:l00000734"} true; + assume {:captureState "l00000734"} true; #10, Gamma_#10 := bvadd32(R0[32:0], 4294967284bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934581bv33))), (Gamma_R0 && Gamma_#10); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#10, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967285bv33))), (Gamma_R0 && Gamma_#10); @@ -327,7 +327,7 @@ procedure main() } goto l00000628; l00000628: - assume {:captureState "addr:l00000628"} true; + assume {:captureState "l00000628"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 4294967291bv32)), Gamma_R0; @@ -337,7 +337,7 @@ procedure main() assume {:captureState "%0000063e"} true; goto l00000360; l0000075c: - assume {:captureState "addr:l0000075c"} true; + assume {:captureState "l0000075c"} true; #11, Gamma_#11 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#11); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#11, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967293bv33))), (Gamma_R0 && Gamma_#11); @@ -349,7 +349,7 @@ procedure main() } goto l0000077b; l0000069c: - assume {:captureState "addr:l0000069c"} true; + assume {:captureState "l0000069c"} true; R1, Gamma_R1 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); @@ -360,14 +360,14 @@ procedure main() assume {:captureState "%000006b4"} true; goto l00000360; l0000077b: - assume {:captureState "addr:l0000077b"} true; + assume {:captureState "l0000077b"} true; assert (Gamma_ZF && (Gamma_VF && Gamma_NF)); if ((bvand1(bvcomp1(NF, VF), bvcomp1(ZF, 0bv1)) != 0bv1)) { goto l000005bc; } goto l00000784; l000005bc: - assume {:captureState "addr:l000005bc"} true; + assume {:captureState "l000005bc"} true; #5, Gamma_#5 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#5); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#5, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967292bv33))), (Gamma_R0 && Gamma_#5); @@ -379,7 +379,7 @@ procedure main() } goto l00000682; l000005d6: - assume {:captureState "addr:l000005d6"} true; + assume {:captureState "l000005d6"} true; R1, Gamma_R1 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); @@ -390,7 +390,7 @@ procedure main() assume {:captureState "%000005f3"} true; goto l00000360; l00000682: - assume {:captureState "addr:l00000682"} true; + assume {:captureState "l00000682"} true; R1, Gamma_R1 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); @@ -401,7 +401,7 @@ procedure main() assume {:captureState "%0000069a"} true; goto l00000317; l00000317: - assume {:captureState "addr:l00000317"} true; + assume {:captureState "l00000317"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 6bv32)), Gamma_R0; @@ -411,7 +411,7 @@ procedure main() assume {:captureState "%0000032f"} true; goto l00000331; l00000331: - assume {:captureState "addr:l00000331"} true; + assume {:captureState "l00000331"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 4294967289bv32)), Gamma_R0; @@ -421,7 +421,7 @@ procedure main() assume {:captureState "%00000344"} true; goto l00000347; l00000347: - assume {:captureState "addr:l00000347"} true; + assume {:captureState "l00000347"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 4294967295bv32)), Gamma_R0; @@ -431,7 +431,7 @@ procedure main() assume {:captureState "%0000035d"} true; goto l00000360; l00000784: - assume {:captureState "addr:l00000784"} true; + assume {:captureState "l00000784"} true; R1, Gamma_R1 := 69632bv64, true; #12, Gamma_#12 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#12); @@ -444,7 +444,7 @@ procedure main() } goto l000007a8; l000006ba: - assume {:captureState "addr:l000006ba"} true; + assume {:captureState "l000006ba"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 6bv32)), Gamma_R0; @@ -454,7 +454,7 @@ procedure main() assume {:captureState "%000006cd"} true; goto l000006d0; l000007a8: - assume {:captureState "addr:l000007a8"} true; + assume {:captureState "l000007a8"} true; #13, Gamma_#13 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#13, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#13); CF, Gamma_CF := bvnot1(bvcomp33(zero_extend1_32(bvadd32(#13, 1bv32)), bvadd33(zero_extend1_32(R0[32:0]), 4294967294bv33))), (Gamma_R0 && Gamma_#13); @@ -466,18 +466,18 @@ procedure main() } goto l000006d0; l00000368: - assume {:captureState "addr:l00000368"} true; + assume {:captureState "l00000368"} true; assert Gamma_R0; if ((bvnot1(bvcomp32(R0[32:0], 0bv32)) != 0bv1)) { goto l0000036b; } goto l000005a3; l0000036b: - assume {:captureState "addr:l0000036b"} true; + assume {:captureState "l0000036b"} true; R0, Gamma_R0 := 1bv64, true; return; l000005a3: - assume {:captureState "addr:l000005a3"} true; + assume {:captureState "l000005a3"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 2bv32)), Gamma_R0; @@ -487,7 +487,7 @@ procedure main() assume {:captureState "%000005b6"} true; goto l00000360; l000006d0: - assume {:captureState "addr:l000006d0"} true; + assume {:captureState "l000006d0"} true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R1, 16bv64))), (gamma_load32(Gamma_mem, bvadd64(R1, 16bv64)) || L(mem, bvadd64(R1, 16bv64))); R0, Gamma_R0 := zero_extend32_32(bvadd32(R0[32:0], 4294967289bv32)), Gamma_R0; @@ -497,6 +497,6 @@ procedure main() assume {:captureState "%000006e6"} true; goto l00000360; l00000360: - assume {:captureState "addr:l00000360"} true; + assume {:captureState "l00000360"} true; return; } diff --git a/src/test/correct/jumptable3/gcc_no_plt_no_pic/jumptable3.expected b/src/test/correct/jumptable3/gcc_no_plt_no_pic/jumptable3.expected index 910e07a93..5a02b2247 100644 --- a/src/test/correct/jumptable3/gcc_no_plt_no_pic/jumptable3.expected +++ b/src/test/correct/jumptable3/gcc_no_plt_no_pic/jumptable3.expected @@ -1,69 +1,69 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -104,7 +104,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -113,9 +113,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure add_six() @@ -194,7 +194,7 @@ procedure add_six() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { ladd_six: - assume {:captureState "addr:ladd_six"} true; + assume {:captureState "ladd_six"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -285,7 +285,7 @@ procedure add_two() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { ladd_two: - assume {:captureState "addr:ladd_two"} true; + assume {:captureState "ladd_two"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); @@ -455,7 +455,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%000012b1"} true; @@ -479,7 +479,7 @@ procedure main() } goto l0000133b; l0000133b: - assume {:captureState "addr:l0000133b"} true; + assume {:captureState "l0000133b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967284bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934581bv33))), (Gamma_R0 && Gamma_#6); @@ -492,7 +492,7 @@ procedure main() } goto l00001363; l00001363: - assume {:captureState "addr:l00001363"} true; + assume {:captureState "l00001363"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #7, Gamma_#7 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#7); @@ -505,35 +505,35 @@ procedure main() } goto l0000139e; l00001384: - assume {:captureState "addr:l00001384"} true; + assume {:captureState "l00001384"} true; R30, Gamma_R30 := 2288bv64, true; call sub_seven(); goto l00001390; l00001390: - assume {:captureState "addr:l00001390"} true; + assume {:captureState "l00001390"} true; R30, Gamma_R30 := 2292bv64, true; call add_two(); goto l00001397; l00001397: - assume {:captureState "addr:l00001397"} true; + assume {:captureState "l00001397"} true; R30, Gamma_R30 := 2296bv64, true; call add_six(); goto l000012f4; l000012f4: - assume {:captureState "addr:l000012f4"} true; + assume {:captureState "l000012f4"} true; R30, Gamma_R30 := 2300bv64, true; call sub_seven(); goto l00001300; l00001300: - assume {:captureState "addr:l00001300"} true; + assume {:captureState "l00001300"} true; R30, Gamma_R30 := 2304bv64, true; call add_two(); goto l00001307; l00001307: - assume {:captureState "addr:l00001307"} true; + assume {:captureState "l00001307"} true; goto l00001308; l0000139e: - assume {:captureState "addr:l0000139e"} true; + assume {:captureState "l0000139e"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #8, Gamma_#8 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#8); @@ -546,7 +546,7 @@ procedure main() } goto l000013c6; l000013c6: - assume {:captureState "addr:l000013c6"} true; + assume {:captureState "l000013c6"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #9, Gamma_#9 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#9); @@ -559,20 +559,20 @@ procedure main() } goto l000013fe; l000013e7: - assume {:captureState "addr:l000013e7"} true; + assume {:captureState "l000013e7"} true; R30, Gamma_R30 := 2276bv64, true; call add_two(); goto l000013f3; l000013f3: - assume {:captureState "addr:l000013f3"} true; + assume {:captureState "l000013f3"} true; R30, Gamma_R30 := 2280bv64, true; call add_six(); goto l000013fa; l000013fa: - assume {:captureState "addr:l000013fa"} true; + assume {:captureState "l000013fa"} true; goto l00001308; l000013fe: - assume {:captureState "addr:l000013fe"} true; + assume {:captureState "l000013fe"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #10, Gamma_#10 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#10); @@ -585,7 +585,7 @@ procedure main() } goto l00001426; l00001426: - assume {:captureState "addr:l00001426"} true; + assume {:captureState "l00001426"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #11, Gamma_#11 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#11); @@ -598,7 +598,7 @@ procedure main() } goto l0000145e; l0000145e: - assume {:captureState "addr:l0000145e"} true; + assume {:captureState "l0000145e"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #12, Gamma_#12 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#12); @@ -611,7 +611,7 @@ procedure main() } goto l00001486; l00001486: - assume {:captureState "addr:l00001486"} true; + assume {:captureState "l00001486"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #13, Gamma_#13 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#13, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#13); @@ -624,7 +624,7 @@ procedure main() } goto l000014b3; l000014b3: - assume {:captureState "addr:l000014b3"} true; + assume {:captureState "l000014b3"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #14, Gamma_#14 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#14, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#14); @@ -637,7 +637,7 @@ procedure main() } goto l000014db; l000014db: - assume {:captureState "addr:l000014db"} true; + assume {:captureState "l000014db"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #15, Gamma_#15 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#15, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#15); @@ -650,7 +650,7 @@ procedure main() } goto l00001508; l00001508: - assume {:captureState "addr:l00001508"} true; + assume {:captureState "l00001508"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #16, Gamma_#16 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#16, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#16); @@ -663,7 +663,7 @@ procedure main() } goto l00001530; l00001530: - assume {:captureState "addr:l00001530"} true; + assume {:captureState "l00001530"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #17, Gamma_#17 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#17, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#17); @@ -676,40 +676,40 @@ procedure main() } goto l00001564; l00001551: - assume {:captureState "addr:l00001551"} true; + assume {:captureState "l00001551"} true; R30, Gamma_R30 := 2248bv64, true; call add_six(); goto l0000155d; l0000155d: - assume {:captureState "addr:l0000155d"} true; + assume {:captureState "l0000155d"} true; R30, Gamma_R30 := 2252bv64, true; call add_two(); goto l000014fc; l000014fc: - assume {:captureState "addr:l000014fc"} true; + assume {:captureState "l000014fc"} true; R30, Gamma_R30 := 2256bv64, true; call add_six(); goto l000014a7; l000014a7: - assume {:captureState "addr:l000014a7"} true; + assume {:captureState "l000014a7"} true; R30, Gamma_R30 := 2260bv64, true; call sub_seven(); goto l00001447; l00001447: - assume {:captureState "addr:l00001447"} true; + assume {:captureState "l00001447"} true; R30, Gamma_R30 := 2264bv64, true; call sub_seven(); goto l00001453; l00001453: - assume {:captureState "addr:l00001453"} true; + assume {:captureState "l00001453"} true; R30, Gamma_R30 := 2268bv64, true; call add_six(); goto l0000145a; l0000145a: - assume {:captureState "addr:l0000145a"} true; + assume {:captureState "l0000145a"} true; goto l00001308; l00001564: - assume {:captureState "addr:l00001564"} true; + assume {:captureState "l00001564"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #18, Gamma_#18 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#18, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#18); @@ -722,7 +722,7 @@ procedure main() } goto l0000158c; l0000158c: - assume {:captureState "addr:l0000158c"} true; + assume {:captureState "l0000158c"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #19, Gamma_#19 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#19, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#19); @@ -735,15 +735,15 @@ procedure main() } goto l000015bd; l000015ad: - assume {:captureState "addr:l000015ad"} true; + assume {:captureState "l000015ad"} true; R30, Gamma_R30 := 2240bv64, true; call add_six(); goto l000015b9; l000015b9: - assume {:captureState "addr:l000015b9"} true; + assume {:captureState "l000015b9"} true; goto l00001308; l000015bd: - assume {:captureState "addr:l000015bd"} true; + assume {:captureState "l000015bd"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #20, Gamma_#20 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#20, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#20); @@ -756,7 +756,7 @@ procedure main() } goto l000015e5; l000015e5: - assume {:captureState "addr:l000015e5"} true; + assume {:captureState "l000015e5"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #21, Gamma_#21 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#21, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#21); @@ -769,20 +769,20 @@ procedure main() } goto l0000161d; l00001606: - assume {:captureState "addr:l00001606"} true; + assume {:captureState "l00001606"} true; R30, Gamma_R30 := 2228bv64, true; call add_two(); goto l00001612; l00001612: - assume {:captureState "addr:l00001612"} true; + assume {:captureState "l00001612"} true; R30, Gamma_R30 := 2232bv64, true; call sub_seven(); goto l00001619; l00001619: - assume {:captureState "addr:l00001619"} true; + assume {:captureState "l00001619"} true; goto l00001308; l0000161d: - assume {:captureState "addr:l0000161d"} true; + assume {:captureState "l0000161d"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #22, Gamma_#22 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#22, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#22); @@ -795,7 +795,7 @@ procedure main() } goto l00001645; l00001645: - assume {:captureState "addr:l00001645"} true; + assume {:captureState "l00001645"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #23, Gamma_#23 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#23, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#23); @@ -808,7 +808,7 @@ procedure main() } goto l00001676; l00001676: - assume {:captureState "addr:l00001676"} true; + assume {:captureState "l00001676"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #24, Gamma_#24 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#24, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#24); @@ -821,7 +821,7 @@ procedure main() } goto l0000169e; l0000169e: - assume {:captureState "addr:l0000169e"} true; + assume {:captureState "l0000169e"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #25, Gamma_#25 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#25, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#25); @@ -834,15 +834,15 @@ procedure main() } goto l000016d6; l000016bf: - assume {:captureState "addr:l000016bf"} true; + assume {:captureState "l000016bf"} true; R30, Gamma_R30 := 2208bv64, true; call add_two(); goto l000016cb; l000016cb: - assume {:captureState "addr:l000016cb"} true; + assume {:captureState "l000016cb"} true; goto l00001308; l000016d6: - assume {:captureState "addr:l000016d6"} true; + assume {:captureState "l000016d6"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #26, Gamma_#26 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#26, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#26); @@ -855,34 +855,34 @@ procedure main() } goto l000016fc; l000016cf: - assume {:captureState "addr:l000016cf"} true; + assume {:captureState "l000016cf"} true; R30, Gamma_R30 := 2216bv64, true; call add_six(); goto l00001666; l00001666: - assume {:captureState "addr:l00001666"} true; + assume {:captureState "l00001666"} true; R30, Gamma_R30 := 2220bv64, true; call sub_seven(); goto l00001672; l00001672: - assume {:captureState "addr:l00001672"} true; + assume {:captureState "l00001672"} true; goto l00001308; l00001308: - assume {:captureState "addr:l00001308"} true; + assume {:captureState "l00001308"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); goto l0000131d; l000016fc: - assume {:captureState "addr:l000016fc"} true; + assume {:captureState "l000016fc"} true; goto l00001332; l00001332: - assume {:captureState "addr:l00001332"} true; + assume {:captureState "l00001332"} true; R0, Gamma_R0 := 1bv64, true; goto l0000131d; l0000131d: - assume {:captureState "addr:l0000131d"} true; + assume {:captureState "l0000131d"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; @@ -965,7 +965,7 @@ procedure sub_seven() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lsub_seven: - assume {:captureState "addr:lsub_seven"} true; + assume {:captureState "lsub_seven"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 16bv64), Gamma_R0; call rely(); diff --git a/src/test/correct/jumptable3/gcc_pic/jumptable3.expected b/src/test/correct/jumptable3/gcc_pic/jumptable3.expected index c69c316c7..e08035a08 100644 --- a/src/test/correct/jumptable3/gcc_pic/jumptable3.expected +++ b/src/test/correct/jumptable3/gcc_pic/jumptable3.expected @@ -1,69 +1,69 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -112,7 +112,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -121,9 +121,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure add_six() @@ -218,7 +218,7 @@ procedure add_six() free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { ladd_six: - assume {:captureState "addr:ladd_six"} true; + assume {:captureState "ladd_six"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -327,7 +327,7 @@ procedure add_two() free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { ladd_two: - assume {:captureState "addr:ladd_two"} true; + assume {:captureState "ladd_two"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -515,7 +515,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%0000055c"} true; @@ -539,7 +539,7 @@ procedure main() } goto l000005e7; l000005e7: - assume {:captureState "addr:l000005e7"} true; + assume {:captureState "l000005e7"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967284bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934581bv33))), (Gamma_R0 && Gamma_#6); @@ -552,7 +552,7 @@ procedure main() } goto l0000060f; l0000060f: - assume {:captureState "addr:l0000060f"} true; + assume {:captureState "l0000060f"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #7, Gamma_#7 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#7); @@ -565,35 +565,35 @@ procedure main() } goto l0000064a; l00000630: - assume {:captureState "addr:l00000630"} true; + assume {:captureState "l00000630"} true; R30, Gamma_R30 := 2352bv64, true; call sub_seven(); goto l0000063c; l0000063c: - assume {:captureState "addr:l0000063c"} true; + assume {:captureState "l0000063c"} true; R30, Gamma_R30 := 2356bv64, true; call add_two(); goto l00000643; l00000643: - assume {:captureState "addr:l00000643"} true; + assume {:captureState "l00000643"} true; R30, Gamma_R30 := 2360bv64, true; call add_six(); goto l0000059f; l0000059f: - assume {:captureState "addr:l0000059f"} true; + assume {:captureState "l0000059f"} true; R30, Gamma_R30 := 2364bv64, true; call sub_seven(); goto l000005ab; l000005ab: - assume {:captureState "addr:l000005ab"} true; + assume {:captureState "l000005ab"} true; R30, Gamma_R30 := 2368bv64, true; call add_two(); goto l000005b2; l000005b2: - assume {:captureState "addr:l000005b2"} true; + assume {:captureState "l000005b2"} true; goto l000005b3; l0000064a: - assume {:captureState "addr:l0000064a"} true; + assume {:captureState "l0000064a"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #8, Gamma_#8 := bvadd32(R0[32:0], 4294967285bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934582bv33))), (Gamma_R0 && Gamma_#8); @@ -606,7 +606,7 @@ procedure main() } goto l00000672; l00000672: - assume {:captureState "addr:l00000672"} true; + assume {:captureState "l00000672"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #9, Gamma_#9 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#9); @@ -619,20 +619,20 @@ procedure main() } goto l000006aa; l00000693: - assume {:captureState "addr:l00000693"} true; + assume {:captureState "l00000693"} true; R30, Gamma_R30 := 2340bv64, true; call add_two(); goto l0000069f; l0000069f: - assume {:captureState "addr:l0000069f"} true; + assume {:captureState "l0000069f"} true; R30, Gamma_R30 := 2344bv64, true; call add_six(); goto l000006a6; l000006a6: - assume {:captureState "addr:l000006a6"} true; + assume {:captureState "l000006a6"} true; goto l000005b3; l000006aa: - assume {:captureState "addr:l000006aa"} true; + assume {:captureState "l000006aa"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #10, Gamma_#10 := bvadd32(R0[32:0], 4294967286bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934583bv33))), (Gamma_R0 && Gamma_#10); @@ -645,7 +645,7 @@ procedure main() } goto l000006d2; l000006d2: - assume {:captureState "addr:l000006d2"} true; + assume {:captureState "l000006d2"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #11, Gamma_#11 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#11); @@ -658,7 +658,7 @@ procedure main() } goto l0000070a; l0000070a: - assume {:captureState "addr:l0000070a"} true; + assume {:captureState "l0000070a"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #12, Gamma_#12 := bvadd32(R0[32:0], 4294967287bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934584bv33))), (Gamma_R0 && Gamma_#12); @@ -671,7 +671,7 @@ procedure main() } goto l00000732; l00000732: - assume {:captureState "addr:l00000732"} true; + assume {:captureState "l00000732"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #13, Gamma_#13 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#13, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#13); @@ -684,7 +684,7 @@ procedure main() } goto l0000075f; l0000075f: - assume {:captureState "addr:l0000075f"} true; + assume {:captureState "l0000075f"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #14, Gamma_#14 := bvadd32(R0[32:0], 4294967288bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#14, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934585bv33))), (Gamma_R0 && Gamma_#14); @@ -697,7 +697,7 @@ procedure main() } goto l00000787; l00000787: - assume {:captureState "addr:l00000787"} true; + assume {:captureState "l00000787"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #15, Gamma_#15 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#15, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#15); @@ -710,7 +710,7 @@ procedure main() } goto l000007b4; l000007b4: - assume {:captureState "addr:l000007b4"} true; + assume {:captureState "l000007b4"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #16, Gamma_#16 := bvadd32(R0[32:0], 4294967289bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#16, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934586bv33))), (Gamma_R0 && Gamma_#16); @@ -723,7 +723,7 @@ procedure main() } goto l000007dc; l000007dc: - assume {:captureState "addr:l000007dc"} true; + assume {:captureState "l000007dc"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #17, Gamma_#17 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#17, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#17); @@ -736,40 +736,40 @@ procedure main() } goto l00000810; l000007fd: - assume {:captureState "addr:l000007fd"} true; + assume {:captureState "l000007fd"} true; R30, Gamma_R30 := 2312bv64, true; call add_six(); goto l00000809; l00000809: - assume {:captureState "addr:l00000809"} true; + assume {:captureState "l00000809"} true; R30, Gamma_R30 := 2316bv64, true; call add_two(); goto l000007a8; l000007a8: - assume {:captureState "addr:l000007a8"} true; + assume {:captureState "l000007a8"} true; R30, Gamma_R30 := 2320bv64, true; call add_six(); goto l00000753; l00000753: - assume {:captureState "addr:l00000753"} true; + assume {:captureState "l00000753"} true; R30, Gamma_R30 := 2324bv64, true; call sub_seven(); goto l000006f3; l000006f3: - assume {:captureState "addr:l000006f3"} true; + assume {:captureState "l000006f3"} true; R30, Gamma_R30 := 2328bv64, true; call sub_seven(); goto l000006ff; l000006ff: - assume {:captureState "addr:l000006ff"} true; + assume {:captureState "l000006ff"} true; R30, Gamma_R30 := 2332bv64, true; call add_six(); goto l00000706; l00000706: - assume {:captureState "addr:l00000706"} true; + assume {:captureState "l00000706"} true; goto l000005b3; l00000810: - assume {:captureState "addr:l00000810"} true; + assume {:captureState "l00000810"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #18, Gamma_#18 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#18, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#18); @@ -782,7 +782,7 @@ procedure main() } goto l00000838; l00000838: - assume {:captureState "addr:l00000838"} true; + assume {:captureState "l00000838"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #19, Gamma_#19 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#19, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#19); @@ -795,15 +795,15 @@ procedure main() } goto l00000869; l00000859: - assume {:captureState "addr:l00000859"} true; + assume {:captureState "l00000859"} true; R30, Gamma_R30 := 2304bv64, true; call add_six(); goto l00000865; l00000865: - assume {:captureState "addr:l00000865"} true; + assume {:captureState "l00000865"} true; goto l000005b3; l00000869: - assume {:captureState "addr:l00000869"} true; + assume {:captureState "l00000869"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #20, Gamma_#20 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#20, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#20); @@ -816,7 +816,7 @@ procedure main() } goto l00000891; l00000891: - assume {:captureState "addr:l00000891"} true; + assume {:captureState "l00000891"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #21, Gamma_#21 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#21, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#21); @@ -829,20 +829,20 @@ procedure main() } goto l000008c9; l000008b2: - assume {:captureState "addr:l000008b2"} true; + assume {:captureState "l000008b2"} true; R30, Gamma_R30 := 2292bv64, true; call add_two(); goto l000008be; l000008be: - assume {:captureState "addr:l000008be"} true; + assume {:captureState "l000008be"} true; R30, Gamma_R30 := 2296bv64, true; call sub_seven(); goto l000008c5; l000008c5: - assume {:captureState "addr:l000008c5"} true; + assume {:captureState "l000008c5"} true; goto l000005b3; l000008c9: - assume {:captureState "addr:l000008c9"} true; + assume {:captureState "l000008c9"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #22, Gamma_#22 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#22, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#22); @@ -855,7 +855,7 @@ procedure main() } goto l000008f1; l000008f1: - assume {:captureState "addr:l000008f1"} true; + assume {:captureState "l000008f1"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #23, Gamma_#23 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#23, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#23); @@ -868,7 +868,7 @@ procedure main() } goto l00000922; l00000922: - assume {:captureState "addr:l00000922"} true; + assume {:captureState "l00000922"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #24, Gamma_#24 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#24, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#24); @@ -881,7 +881,7 @@ procedure main() } goto l0000094a; l0000094a: - assume {:captureState "addr:l0000094a"} true; + assume {:captureState "l0000094a"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #25, Gamma_#25 := bvadd32(R0[32:0], 4294967295bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#25, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 0bv33))), (Gamma_R0 && Gamma_#25); @@ -894,15 +894,15 @@ procedure main() } goto l00000982; l0000096b: - assume {:captureState "addr:l0000096b"} true; + assume {:captureState "l0000096b"} true; R30, Gamma_R30 := 2272bv64, true; call add_two(); goto l00000977; l00000977: - assume {:captureState "addr:l00000977"} true; + assume {:captureState "l00000977"} true; goto l000005b3; l00000982: - assume {:captureState "addr:l00000982"} true; + assume {:captureState "l00000982"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #26, Gamma_#26 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#26, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#26); @@ -915,20 +915,20 @@ procedure main() } goto l000009a8; l0000097b: - assume {:captureState "addr:l0000097b"} true; + assume {:captureState "l0000097b"} true; R30, Gamma_R30 := 2280bv64, true; call add_six(); goto l00000912; l00000912: - assume {:captureState "addr:l00000912"} true; + assume {:captureState "l00000912"} true; R30, Gamma_R30 := 2284bv64, true; call sub_seven(); goto l0000091e; l0000091e: - assume {:captureState "addr:l0000091e"} true; + assume {:captureState "l0000091e"} true; goto l000005b3; l000005b3: - assume {:captureState "addr:l000005b3"} true; + assume {:captureState "l000005b3"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -936,14 +936,14 @@ procedure main() R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); goto l000005c9; l000009a8: - assume {:captureState "addr:l000009a8"} true; + assume {:captureState "l000009a8"} true; goto l000005de; l000005de: - assume {:captureState "addr:l000005de"} true; + assume {:captureState "l000005de"} true; R0, Gamma_R0 := 1bv64, true; goto l000005c9; l000005c9: - assume {:captureState "addr:l000005c9"} true; + assume {:captureState "l000005c9"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; @@ -1042,7 +1042,7 @@ procedure sub_seven() free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); { lsub_seven: - assume {:captureState "addr:lsub_seven"} true; + assume {:captureState "lsub_seven"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); diff --git a/src/test/correct/malloc_with_local/clang/malloc_with_local.expected b/src/test/correct/malloc_with_local/clang/malloc_with_local.expected index ce31f45fd..ecaf1a185 100644 --- a/src/test/correct/malloc_with_local/clang/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/clang/malloc_with_local.expected @@ -1,83 +1,83 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2256bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,9 +187,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -607,7 +607,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -625,7 +625,7 @@ procedure main() call malloc(); goto l00000391; l00000391: - assume {:captureState "addr:l00000391"} true; + assume {:captureState "l00000391"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); assume {:captureState "%00000397"} true; R0, Gamma_R0 := 4bv64, true; @@ -633,7 +633,7 @@ procedure main() call malloc(); goto l000003a5; l000003a5: - assume {:captureState "addr:l000003a5"} true; + assume {:captureState "l000003a5"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); assume {:captureState "%000003ab"} true; R8, Gamma_R8 := 10bv64, true; @@ -660,7 +660,7 @@ procedure main() call printf(); goto l00000403; l00000403: - assume {:captureState "addr:l00000403"} true; + assume {:captureState "l00000403"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -670,7 +670,7 @@ procedure main() call printf(); goto l00000423; l00000423: - assume {:captureState "addr:l00000423"} true; + assume {:captureState "l00000423"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2293bv64), Gamma_R0; @@ -678,19 +678,19 @@ procedure main() call printf(); goto l0000043c; l0000043c: - assume {:captureState "addr:l0000043c"} true; + assume {:captureState "l0000043c"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2212bv64, true; call #free(); goto l0000044b; l0000044b: - assume {:captureState "addr:l0000044b"} true; + assume {:captureState "l0000044b"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2220bv64, true; call #free(); goto l00000459; l00000459: - assume {:captureState "addr:l00000459"} true; + assume {:captureState "l00000459"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, R31)), gamma_load32(Gamma_stack, R31); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/malloc_with_local/clang_O2/malloc_with_local.expected b/src/test/correct/malloc_with_local/clang_O2/malloc_with_local.expected index 6e1fa0e08..775c83e11 100644 --- a/src/test/correct/malloc_with_local/clang_O2/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/clang_O2/malloc_with_local.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1964bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -140,7 +140,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -149,9 +149,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -372,7 +372,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%000002f8"} true; @@ -387,7 +387,7 @@ procedure main() call printf(); goto l00000322; l00000322: - assume {:captureState "addr:l00000322"} true; + assume {:captureState "l00000322"} true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 1985bv64), Gamma_R0; R1, Gamma_R1 := 42bv64, true; @@ -395,7 +395,7 @@ procedure main() call printf(); goto l00000339; l00000339: - assume {:captureState "addr:l00000339"} true; + assume {:captureState "l00000339"} true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2001bv64), Gamma_R0; R1, Gamma_R1 := 10bv64, true; @@ -403,7 +403,7 @@ procedure main() call printf(); goto l00000350; l00000350: - assume {:captureState "addr:l00000350"} true; + assume {:captureState "l00000350"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local/clang_no_plt_no_pic/malloc_with_local.expected b/src/test/correct/malloc_with_local/clang_no_plt_no_pic/malloc_with_local.expected index c70421f04..07ac928d3 100644 --- a/src/test/correct/malloc_with_local/clang_no_plt_no_pic/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/clang_no_plt_no_pic/malloc_with_local.expected @@ -1,83 +1,83 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2256bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,9 +187,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -607,7 +607,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -625,7 +625,7 @@ procedure main() call malloc(); goto l00000b03; l00000b03: - assume {:captureState "addr:l00000b03"} true; + assume {:captureState "l00000b03"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); assume {:captureState "%00000b09"} true; R0, Gamma_R0 := 4bv64, true; @@ -633,7 +633,7 @@ procedure main() call malloc(); goto l00000b17; l00000b17: - assume {:captureState "addr:l00000b17"} true; + assume {:captureState "l00000b17"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); assume {:captureState "%00000b1d"} true; R8, Gamma_R8 := 10bv64, true; @@ -660,7 +660,7 @@ procedure main() call printf(); goto l00000b75; l00000b75: - assume {:captureState "addr:l00000b75"} true; + assume {:captureState "l00000b75"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -670,7 +670,7 @@ procedure main() call printf(); goto l00000b95; l00000b95: - assume {:captureState "addr:l00000b95"} true; + assume {:captureState "l00000b95"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2293bv64), Gamma_R0; @@ -678,19 +678,19 @@ procedure main() call printf(); goto l00000bae; l00000bae: - assume {:captureState "addr:l00000bae"} true; + assume {:captureState "l00000bae"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2212bv64, true; call #free(); goto l00000bbd; l00000bbd: - assume {:captureState "addr:l00000bbd"} true; + assume {:captureState "l00000bbd"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2220bv64, true; call #free(); goto l00000bcb; l00000bcb: - assume {:captureState "addr:l00000bcb"} true; + assume {:captureState "l00000bcb"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, R31)), gamma_load32(Gamma_stack, R31); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/malloc_with_local/clang_pic/malloc_with_local.expected b/src/test/correct/malloc_with_local/clang_pic/malloc_with_local.expected index c70421f04..07ac928d3 100644 --- a/src/test/correct/malloc_with_local/clang_pic/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/clang_pic/malloc_with_local.expected @@ -1,83 +1,83 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2256bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,9 +187,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -607,7 +607,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -625,7 +625,7 @@ procedure main() call malloc(); goto l00000b03; l00000b03: - assume {:captureState "addr:l00000b03"} true; + assume {:captureState "l00000b03"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); assume {:captureState "%00000b09"} true; R0, Gamma_R0 := 4bv64, true; @@ -633,7 +633,7 @@ procedure main() call malloc(); goto l00000b17; l00000b17: - assume {:captureState "addr:l00000b17"} true; + assume {:captureState "l00000b17"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); assume {:captureState "%00000b1d"} true; R8, Gamma_R8 := 10bv64, true; @@ -660,7 +660,7 @@ procedure main() call printf(); goto l00000b75; l00000b75: - assume {:captureState "addr:l00000b75"} true; + assume {:captureState "l00000b75"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -670,7 +670,7 @@ procedure main() call printf(); goto l00000b95; l00000b95: - assume {:captureState "addr:l00000b95"} true; + assume {:captureState "l00000b95"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2293bv64), Gamma_R0; @@ -678,19 +678,19 @@ procedure main() call printf(); goto l00000bae; l00000bae: - assume {:captureState "addr:l00000bae"} true; + assume {:captureState "l00000bae"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2212bv64, true; call #free(); goto l00000bbd; l00000bbd: - assume {:captureState "addr:l00000bbd"} true; + assume {:captureState "l00000bbd"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2220bv64, true; call #free(); goto l00000bcb; l00000bcb: - assume {:captureState "addr:l00000bcb"} true; + assume {:captureState "l00000bcb"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, R31)), gamma_load32(Gamma_stack, R31); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/malloc_with_local/gcc/malloc_with_local.expected b/src/test/correct/malloc_with_local/gcc/malloc_with_local.expected index 2219ee6ab..7853707b6 100644 --- a/src/test/correct/malloc_with_local/gcc/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/gcc/malloc_with_local.expected @@ -1,79 +1,79 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2248bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,9 +194,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -656,7 +656,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000350"} true; @@ -669,7 +669,7 @@ procedure main() call malloc(); goto l0000036f; l0000036f: - assume {:captureState "addr:l0000036f"} true; + assume {:captureState "l0000036f"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); assume {:captureState "%00000375"} true; R0, Gamma_R0 := 4bv64, true; @@ -677,7 +677,7 @@ procedure main() call malloc(); goto l00000383; l00000383: - assume {:captureState "addr:l00000383"} true; + assume {:captureState "l00000383"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); assume {:captureState "%00000389"} true; R0, Gamma_R0 := 10bv64, true; @@ -705,7 +705,7 @@ procedure main() call printf(); goto l000003e7; l000003e7: - assume {:captureState "addr:l000003e7"} true; + assume {:captureState "l000003e7"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -716,7 +716,7 @@ procedure main() call printf(); goto l0000040d; l0000040d: - assume {:captureState "addr:l0000040d"} true; + assume {:captureState "l0000040d"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2296bv64), Gamma_R0; @@ -724,19 +724,19 @@ procedure main() call printf(); goto l00000426; l00000426: - assume {:captureState "addr:l00000426"} true; + assume {:captureState "l00000426"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2204bv64, true; call #free(); goto l00000435; l00000435: - assume {:captureState "addr:l00000435"} true; + assume {:captureState "l00000435"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2212bv64, true; call #free(); goto l00000443; l00000443: - assume {:captureState "addr:l00000443"} true; + assume {:captureState "l00000443"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local/gcc_O2/malloc_with_local.expected b/src/test/correct/malloc_with_local/gcc_O2/malloc_with_local.expected index e680279cb..2f63e0068 100644 --- a/src/test/correct/malloc_with_local/gcc_O2/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/gcc_O2/malloc_with_local.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R2: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2088bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -153,7 +153,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -162,9 +162,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure __printf_chk(); @@ -624,7 +624,7 @@ procedure main() var #1: bv64; var Gamma_#1: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); assume {:captureState "%000001f2"} true; @@ -640,7 +640,7 @@ procedure main() call __printf_chk(); goto l00000221; l00000221: - assume {:captureState "addr:l00000221"} true; + assume {:captureState "l00000221"} true; R2, Gamma_R2 := 42bv64, true; R1, Gamma_R1 := 0bv64, true; R0, Gamma_R0 := 1bv64, true; @@ -649,7 +649,7 @@ procedure main() call __printf_chk(); goto l0000023d; l0000023d: - assume {:captureState "addr:l0000023d"} true; + assume {:captureState "l0000023d"} true; R2, Gamma_R2 := 10bv64, true; R1, Gamma_R1 := 0bv64, true; R0, Gamma_R0 := 1bv64, true; @@ -658,7 +658,7 @@ procedure main() call __printf_chk(); goto l00000259; l00000259: - assume {:captureState "addr:l00000259"} true; + assume {:captureState "l00000259"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local/gcc_no_plt_no_pic/malloc_with_local.expected b/src/test/correct/malloc_with_local/gcc_no_plt_no_pic/malloc_with_local.expected index d4716b196..91f3ea4d7 100644 --- a/src/test/correct/malloc_with_local/gcc_no_plt_no_pic/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/gcc_no_plt_no_pic/malloc_with_local.expected @@ -1,79 +1,79 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2248bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,9 +194,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -656,7 +656,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000aa1"} true; @@ -669,7 +669,7 @@ procedure main() call malloc(); goto l00000ac0; l00000ac0: - assume {:captureState "addr:l00000ac0"} true; + assume {:captureState "l00000ac0"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); assume {:captureState "%00000ac6"} true; R0, Gamma_R0 := 4bv64, true; @@ -677,7 +677,7 @@ procedure main() call malloc(); goto l00000ad4; l00000ad4: - assume {:captureState "addr:l00000ad4"} true; + assume {:captureState "l00000ad4"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); assume {:captureState "%00000ada"} true; R0, Gamma_R0 := 10bv64, true; @@ -705,7 +705,7 @@ procedure main() call printf(); goto l00000b38; l00000b38: - assume {:captureState "addr:l00000b38"} true; + assume {:captureState "l00000b38"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -716,7 +716,7 @@ procedure main() call printf(); goto l00000b5e; l00000b5e: - assume {:captureState "addr:l00000b5e"} true; + assume {:captureState "l00000b5e"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2296bv64), Gamma_R0; @@ -724,19 +724,19 @@ procedure main() call printf(); goto l00000b77; l00000b77: - assume {:captureState "addr:l00000b77"} true; + assume {:captureState "l00000b77"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2204bv64, true; call #free(); goto l00000b86; l00000b86: - assume {:captureState "addr:l00000b86"} true; + assume {:captureState "l00000b86"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2212bv64, true; call #free(); goto l00000b94; l00000b94: - assume {:captureState "addr:l00000b94"} true; + assume {:captureState "l00000b94"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local/gcc_pic/malloc_with_local.expected b/src/test/correct/malloc_with_local/gcc_pic/malloc_with_local.expected index d4716b196..91f3ea4d7 100644 --- a/src/test/correct/malloc_with_local/gcc_pic/malloc_with_local.expected +++ b/src/test/correct/malloc_with_local/gcc_pic/malloc_with_local.expected @@ -1,79 +1,79 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2248bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,9 +194,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -656,7 +656,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000aa1"} true; @@ -669,7 +669,7 @@ procedure main() call malloc(); goto l00000ac0; l00000ac0: - assume {:captureState "addr:l00000ac0"} true; + assume {:captureState "l00000ac0"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R0); assume {:captureState "%00000ac6"} true; R0, Gamma_R0 := 4bv64, true; @@ -677,7 +677,7 @@ procedure main() call malloc(); goto l00000ad4; l00000ad4: - assume {:captureState "addr:l00000ad4"} true; + assume {:captureState "l00000ad4"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); assume {:captureState "%00000ada"} true; R0, Gamma_R0 := 10bv64, true; @@ -705,7 +705,7 @@ procedure main() call printf(); goto l00000b38; l00000b38: - assume {:captureState "addr:l00000b38"} true; + assume {:captureState "l00000b38"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -716,7 +716,7 @@ procedure main() call printf(); goto l00000b5e; l00000b5e: - assume {:captureState "addr:l00000b5e"} true; + assume {:captureState "l00000b5e"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2296bv64), Gamma_R0; @@ -724,19 +724,19 @@ procedure main() call printf(); goto l00000b77; l00000b77: - assume {:captureState "addr:l00000b77"} true; + assume {:captureState "l00000b77"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2204bv64, true; call #free(); goto l00000b86; l00000b86: - assume {:captureState "addr:l00000b86"} true; + assume {:captureState "l00000b86"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2212bv64, true; call #free(); goto l00000b94; l00000b94: - assume {:captureState "addr:l00000b94"} true; + assume {:captureState "l00000b94"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local2/clang/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/clang/malloc_with_local2.expected index 7b71ddd4c..6030ae003 100644 --- a/src/test/correct/malloc_with_local2/clang/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/clang/malloc_with_local2.expected @@ -1,83 +1,83 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2292bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,9 +187,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -607,7 +607,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -625,7 +625,7 @@ procedure main() call malloc(); goto l000003b5; l000003b5: - assume {:captureState "addr:l000003b5"} true; + assume {:captureState "l000003b5"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R29, 18446744073709551600bv64), R0), gamma_store64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64), Gamma_R0); assume {:captureState "%000003bb"} true; R8, Gamma_R8 := 11bv64, true; @@ -638,7 +638,7 @@ procedure main() call malloc(); goto l000003de; l000003de: - assume {:captureState "addr:l000003de"} true; + assume {:captureState "l000003de"} true; R8, Gamma_R8 := R0, Gamma_R0; R0, Gamma_R0 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R8); @@ -650,7 +650,7 @@ procedure main() call malloc(); goto l00000407; l00000407: - assume {:captureState "addr:l00000407"} true; + assume {:captureState "l00000407"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); assume {:captureState "%0000040d"} true; R8, Gamma_R8 := 9bv64, true; @@ -677,7 +677,7 @@ procedure main() call printf(); goto l00000465; l00000465: - assume {:captureState "addr:l00000465"} true; + assume {:captureState "l00000465"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -687,7 +687,7 @@ procedure main() call printf(); goto l00000485; l00000485: - assume {:captureState "addr:l00000485"} true; + assume {:captureState "l00000485"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2329bv64), Gamma_R0; @@ -695,19 +695,19 @@ procedure main() call printf(); goto l0000049e; l0000049e: - assume {:captureState "addr:l0000049e"} true; + assume {:captureState "l0000049e"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2248bv64, true; call #free(); goto l000004ad; l000004ad: - assume {:captureState "addr:l000004ad"} true; + assume {:captureState "l000004ad"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2256bv64, true; call #free(); goto l000004bb; l000004bb: - assume {:captureState "addr:l000004bb"} true; + assume {:captureState "l000004bb"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd64(R31, 64bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/malloc_with_local2/clang_O2/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/clang_O2/malloc_with_local2.expected index 6e1fa0e08..775c83e11 100644 --- a/src/test/correct/malloc_with_local2/clang_O2/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/clang_O2/malloc_with_local2.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1964bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -140,7 +140,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -149,9 +149,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -372,7 +372,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%000002f8"} true; @@ -387,7 +387,7 @@ procedure main() call printf(); goto l00000322; l00000322: - assume {:captureState "addr:l00000322"} true; + assume {:captureState "l00000322"} true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 1985bv64), Gamma_R0; R1, Gamma_R1 := 42bv64, true; @@ -395,7 +395,7 @@ procedure main() call printf(); goto l00000339; l00000339: - assume {:captureState "addr:l00000339"} true; + assume {:captureState "l00000339"} true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2001bv64), Gamma_R0; R1, Gamma_R1 := 10bv64, true; @@ -403,7 +403,7 @@ procedure main() call printf(); goto l00000350; l00000350: - assume {:captureState "addr:l00000350"} true; + assume {:captureState "l00000350"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local2/clang_no_plt_no_pic/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/clang_no_plt_no_pic/malloc_with_local2.expected index 29511831b..8645f53a7 100644 --- a/src/test/correct/malloc_with_local2/clang_no_plt_no_pic/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/clang_no_plt_no_pic/malloc_with_local2.expected @@ -1,83 +1,83 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2292bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,9 +187,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -607,7 +607,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -625,7 +625,7 @@ procedure main() call malloc(); goto l00000b92; l00000b92: - assume {:captureState "addr:l00000b92"} true; + assume {:captureState "l00000b92"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R29, 18446744073709551600bv64), R0), gamma_store64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64), Gamma_R0); assume {:captureState "%00000b98"} true; R8, Gamma_R8 := 11bv64, true; @@ -638,7 +638,7 @@ procedure main() call malloc(); goto l00000bbb; l00000bbb: - assume {:captureState "addr:l00000bbb"} true; + assume {:captureState "l00000bbb"} true; R8, Gamma_R8 := R0, Gamma_R0; R0, Gamma_R0 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R8); @@ -650,7 +650,7 @@ procedure main() call malloc(); goto l00000be4; l00000be4: - assume {:captureState "addr:l00000be4"} true; + assume {:captureState "l00000be4"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); assume {:captureState "%00000bea"} true; R8, Gamma_R8 := 9bv64, true; @@ -677,7 +677,7 @@ procedure main() call printf(); goto l00000c42; l00000c42: - assume {:captureState "addr:l00000c42"} true; + assume {:captureState "l00000c42"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -687,7 +687,7 @@ procedure main() call printf(); goto l00000c62; l00000c62: - assume {:captureState "addr:l00000c62"} true; + assume {:captureState "l00000c62"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2329bv64), Gamma_R0; @@ -695,19 +695,19 @@ procedure main() call printf(); goto l00000c7b; l00000c7b: - assume {:captureState "addr:l00000c7b"} true; + assume {:captureState "l00000c7b"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2248bv64, true; call #free(); goto l00000c8a; l00000c8a: - assume {:captureState "addr:l00000c8a"} true; + assume {:captureState "l00000c8a"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2256bv64, true; call #free(); goto l00000c98; l00000c98: - assume {:captureState "addr:l00000c98"} true; + assume {:captureState "l00000c98"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd64(R31, 64bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/malloc_with_local2/clang_pic/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/clang_pic/malloc_with_local2.expected index 29511831b..8645f53a7 100644 --- a/src/test/correct/malloc_with_local2/clang_pic/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/clang_pic/malloc_with_local2.expected @@ -1,83 +1,83 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2292bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -178,7 +178,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -187,9 +187,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -607,7 +607,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -625,7 +625,7 @@ procedure main() call malloc(); goto l00000b92; l00000b92: - assume {:captureState "addr:l00000b92"} true; + assume {:captureState "l00000b92"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R29, 18446744073709551600bv64), R0), gamma_store64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64), Gamma_R0); assume {:captureState "%00000b98"} true; R8, Gamma_R8 := 11bv64, true; @@ -638,7 +638,7 @@ procedure main() call malloc(); goto l00000bbb; l00000bbb: - assume {:captureState "addr:l00000bbb"} true; + assume {:captureState "l00000bbb"} true; R8, Gamma_R8 := R0, Gamma_R0; R0, Gamma_R0 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R8); @@ -650,7 +650,7 @@ procedure main() call malloc(); goto l00000be4; l00000be4: - assume {:captureState "addr:l00000be4"} true; + assume {:captureState "l00000be4"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); assume {:captureState "%00000bea"} true; R8, Gamma_R8 := 9bv64, true; @@ -677,7 +677,7 @@ procedure main() call printf(); goto l00000c42; l00000c42: - assume {:captureState "addr:l00000c42"} true; + assume {:captureState "l00000c42"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -687,7 +687,7 @@ procedure main() call printf(); goto l00000c62; l00000c62: - assume {:captureState "addr:l00000c62"} true; + assume {:captureState "l00000c62"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2329bv64), Gamma_R0; @@ -695,19 +695,19 @@ procedure main() call printf(); goto l00000c7b; l00000c7b: - assume {:captureState "addr:l00000c7b"} true; + assume {:captureState "l00000c7b"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2248bv64, true; call #free(); goto l00000c8a; l00000c8a: - assume {:captureState "addr:l00000c8a"} true; + assume {:captureState "l00000c8a"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2256bv64, true; call #free(); goto l00000c98; l00000c98: - assume {:captureState "addr:l00000c98"} true; + assume {:captureState "l00000c98"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd64(R31, 64bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/malloc_with_local2/gcc/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/gcc/malloc_with_local2.expected index ed0d462a6..503331b2c 100644 --- a/src/test/correct/malloc_with_local2/gcc/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/gcc/malloc_with_local2.expected @@ -1,79 +1,79 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2272bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,9 +194,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -656,7 +656,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%0000036c"} true; @@ -669,7 +669,7 @@ procedure main() call malloc(); goto l0000038b; l0000038b: - assume {:captureState "addr:l0000038b"} true; + assume {:captureState "l0000038b"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); assume {:captureState "%00000391"} true; R0, Gamma_R0 := 11bv64, true; @@ -680,7 +680,7 @@ procedure main() call malloc(); goto l000003ac; l000003ac: - assume {:captureState "addr:l000003ac"} true; + assume {:captureState "l000003ac"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 48bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 48bv64), Gamma_R0); assume {:captureState "%000003b2"} true; R0, Gamma_R0 := 10bv64, true; @@ -691,7 +691,7 @@ procedure main() call malloc(); goto l000003cd; l000003cd: - assume {:captureState "addr:l000003cd"} true; + assume {:captureState "l000003cd"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 56bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 56bv64), Gamma_R0); assume {:captureState "%000003d3"} true; R0, Gamma_R0 := 9bv64, true; @@ -719,7 +719,7 @@ procedure main() call printf(); goto l00000431; l00000431: - assume {:captureState "addr:l00000431"} true; + assume {:captureState "l00000431"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -730,7 +730,7 @@ procedure main() call printf(); goto l00000457; l00000457: - assume {:captureState "addr:l00000457"} true; + assume {:captureState "l00000457"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 32bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 32bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2320bv64), Gamma_R0; @@ -738,19 +738,19 @@ procedure main() call printf(); goto l00000470; l00000470: - assume {:captureState "addr:l00000470"} true; + assume {:captureState "l00000470"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2232bv64, true; call #free(); goto l0000047f; l0000047f: - assume {:captureState "addr:l0000047f"} true; + assume {:captureState "l0000047f"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R30, Gamma_R30 := 2240bv64, true; call #free(); goto l0000048d; l0000048d: - assume {:captureState "addr:l0000048d"} true; + assume {:captureState "l0000048d"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local2/gcc_O2/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/gcc_O2/malloc_with_local2.expected index e680279cb..2f63e0068 100644 --- a/src/test/correct/malloc_with_local2/gcc_O2/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/gcc_O2/malloc_with_local2.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R2: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2088bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -153,7 +153,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -162,9 +162,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure __printf_chk(); @@ -624,7 +624,7 @@ procedure main() var #1: bv64; var Gamma_#1: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); assume {:captureState "%000001f2"} true; @@ -640,7 +640,7 @@ procedure main() call __printf_chk(); goto l00000221; l00000221: - assume {:captureState "addr:l00000221"} true; + assume {:captureState "l00000221"} true; R2, Gamma_R2 := 42bv64, true; R1, Gamma_R1 := 0bv64, true; R0, Gamma_R0 := 1bv64, true; @@ -649,7 +649,7 @@ procedure main() call __printf_chk(); goto l0000023d; l0000023d: - assume {:captureState "addr:l0000023d"} true; + assume {:captureState "l0000023d"} true; R2, Gamma_R2 := 10bv64, true; R1, Gamma_R1 := 0bv64, true; R0, Gamma_R0 := 1bv64, true; @@ -658,7 +658,7 @@ procedure main() call __printf_chk(); goto l00000259; l00000259: - assume {:captureState "addr:l00000259"} true; + assume {:captureState "l00000259"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local2/gcc_no_plt_no_pic/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/gcc_no_plt_no_pic/malloc_with_local2.expected index 6c40463e6..76eed4543 100644 --- a/src/test/correct/malloc_with_local2/gcc_no_plt_no_pic/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/gcc_no_plt_no_pic/malloc_with_local2.expected @@ -1,79 +1,79 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2272bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,9 +194,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -656,7 +656,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000b0e"} true; @@ -669,7 +669,7 @@ procedure main() call malloc(); goto l00000b2d; l00000b2d: - assume {:captureState "addr:l00000b2d"} true; + assume {:captureState "l00000b2d"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); assume {:captureState "%00000b33"} true; R0, Gamma_R0 := 11bv64, true; @@ -680,7 +680,7 @@ procedure main() call malloc(); goto l00000b4e; l00000b4e: - assume {:captureState "addr:l00000b4e"} true; + assume {:captureState "l00000b4e"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 48bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 48bv64), Gamma_R0); assume {:captureState "%00000b54"} true; R0, Gamma_R0 := 10bv64, true; @@ -691,7 +691,7 @@ procedure main() call malloc(); goto l00000b6f; l00000b6f: - assume {:captureState "addr:l00000b6f"} true; + assume {:captureState "l00000b6f"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 56bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 56bv64), Gamma_R0); assume {:captureState "%00000b75"} true; R0, Gamma_R0 := 9bv64, true; @@ -719,7 +719,7 @@ procedure main() call printf(); goto l00000bd3; l00000bd3: - assume {:captureState "addr:l00000bd3"} true; + assume {:captureState "l00000bd3"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -730,7 +730,7 @@ procedure main() call printf(); goto l00000bf9; l00000bf9: - assume {:captureState "addr:l00000bf9"} true; + assume {:captureState "l00000bf9"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 32bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 32bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2320bv64), Gamma_R0; @@ -738,19 +738,19 @@ procedure main() call printf(); goto l00000c12; l00000c12: - assume {:captureState "addr:l00000c12"} true; + assume {:captureState "l00000c12"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2232bv64, true; call #free(); goto l00000c21; l00000c21: - assume {:captureState "addr:l00000c21"} true; + assume {:captureState "l00000c21"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R30, Gamma_R30 := 2240bv64, true; call #free(); goto l00000c2f; l00000c2f: - assume {:captureState "addr:l00000c2f"} true; + assume {:captureState "l00000c2f"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local2/gcc_pic/malloc_with_local2.expected b/src/test/correct/malloc_with_local2/gcc_pic/malloc_with_local2.expected index 6c40463e6..76eed4543 100644 --- a/src/test/correct/malloc_with_local2/gcc_pic/malloc_with_local2.expected +++ b/src/test/correct/malloc_with_local2/gcc_pic/malloc_with_local2.expected @@ -1,79 +1,79 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2272bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,9 +194,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -656,7 +656,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000b0e"} true; @@ -669,7 +669,7 @@ procedure main() call malloc(); goto l00000b2d; l00000b2d: - assume {:captureState "addr:l00000b2d"} true; + assume {:captureState "l00000b2d"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); assume {:captureState "%00000b33"} true; R0, Gamma_R0 := 11bv64, true; @@ -680,7 +680,7 @@ procedure main() call malloc(); goto l00000b4e; l00000b4e: - assume {:captureState "addr:l00000b4e"} true; + assume {:captureState "l00000b4e"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 48bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 48bv64), Gamma_R0); assume {:captureState "%00000b54"} true; R0, Gamma_R0 := 10bv64, true; @@ -691,7 +691,7 @@ procedure main() call malloc(); goto l00000b6f; l00000b6f: - assume {:captureState "addr:l00000b6f"} true; + assume {:captureState "l00000b6f"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 56bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 56bv64), Gamma_R0); assume {:captureState "%00000b75"} true; R0, Gamma_R0 := 9bv64, true; @@ -719,7 +719,7 @@ procedure main() call printf(); goto l00000bd3; l00000bd3: - assume {:captureState "addr:l00000bd3"} true; + assume {:captureState "l00000bd3"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -730,7 +730,7 @@ procedure main() call printf(); goto l00000bf9; l00000bf9: - assume {:captureState "addr:l00000bf9"} true; + assume {:captureState "l00000bf9"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 32bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 32bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2320bv64), Gamma_R0; @@ -738,19 +738,19 @@ procedure main() call printf(); goto l00000c12; l00000c12: - assume {:captureState "addr:l00000c12"} true; + assume {:captureState "l00000c12"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2232bv64, true; call #free(); goto l00000c21; l00000c21: - assume {:captureState "addr:l00000c21"} true; + assume {:captureState "l00000c21"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R30, Gamma_R30 := 2240bv64, true; call #free(); goto l00000c2f; l00000c2f: - assume {:captureState "addr:l00000c2f"} true; + assume {:captureState "l00000c2f"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local3/clang/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/clang/malloc_with_local3.expected index 8e69c60a0..f97fa4098 100644 --- a/src/test/correct/malloc_with_local3/clang/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/clang/malloc_with_local3.expected @@ -1,84 +1,84 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2344bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,9 +194,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -638,7 +638,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#7: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -656,7 +656,7 @@ procedure main() call malloc(); goto l000003e9; l000003e9: - assume {:captureState "addr:l000003e9"} true; + assume {:captureState "l000003e9"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R29, 18446744073709551600bv64), R0), gamma_store64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64), Gamma_R0); assume {:captureState "%000003ef"} true; R8, Gamma_R8 := 11bv64, true; @@ -669,7 +669,7 @@ procedure main() call malloc(); goto l00000412; l00000412: - assume {:captureState "addr:l00000412"} true; + assume {:captureState "l00000412"} true; R8, Gamma_R8 := R0, Gamma_R0; R0, Gamma_R0 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R8); @@ -681,7 +681,7 @@ procedure main() call malloc(); goto l0000043b; l0000043b: - assume {:captureState "addr:l0000043b"} true; + assume {:captureState "l0000043b"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); assume {:captureState "%00000441"} true; R8, Gamma_R8 := 9bv64, true; @@ -704,7 +704,7 @@ procedure main() call printCharValue(); goto l00000504; l00000504: - assume {:captureState "addr:l00000504"} true; + assume {:captureState "l00000504"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -714,7 +714,7 @@ procedure main() call printf(); goto l00000524; l00000524: - assume {:captureState "addr:l00000524"} true; + assume {:captureState "l00000524"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2364bv64), Gamma_R0; @@ -722,19 +722,19 @@ procedure main() call printf(); goto l0000053d; l0000053d: - assume {:captureState "addr:l0000053d"} true; + assume {:captureState "l0000053d"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2236bv64, true; call #free(); goto l0000054c; l0000054c: - assume {:captureState "addr:l0000054c"} true; + assume {:captureState "l0000054c"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2244bv64, true; call #free(); goto l0000055a; l0000055a: - assume {:captureState "addr:l0000055a"} true; + assume {:captureState "l0000055a"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #7, Gamma_#7 := bvadd64(R31, 64bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #7), gamma_load64(Gamma_stack, #7); @@ -1166,7 +1166,7 @@ procedure printCharValue() var Gamma_#5: bool; var Gamma_#6: bool; lprintCharValue: - assume {:captureState "addr:lprintCharValue"} true; + assume {:captureState "lprintCharValue"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); @@ -1193,7 +1193,7 @@ procedure printCharValue() call printf(); goto l000004e9; l000004e9: - assume {:captureState "addr:l000004e9"} true; + assume {:captureState "l000004e9"} true; #6, Gamma_#6 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #6), gamma_load64(Gamma_stack, #6); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(#6, 8bv64)), gamma_load64(Gamma_stack, bvadd64(#6, 8bv64)); diff --git a/src/test/correct/malloc_with_local3/clang_O2/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/clang_O2/malloc_with_local3.expected index 9d9df1295..de0df8c0a 100644 --- a/src/test/correct/malloc_with_local3/clang_O2/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/clang_O2/malloc_with_local3.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1996bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -146,7 +146,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -155,9 +155,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -390,7 +390,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000318"} true; @@ -405,7 +405,7 @@ procedure main() call printf(); goto l00000342; l00000342: - assume {:captureState "addr:l00000342"} true; + assume {:captureState "l00000342"} true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2000bv64), Gamma_R0; R1, Gamma_R1 := 42bv64, true; @@ -413,7 +413,7 @@ procedure main() call printf(); goto l00000359; l00000359: - assume {:captureState "addr:l00000359"} true; + assume {:captureState "l00000359"} true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2016bv64), Gamma_R0; R1, Gamma_R1 := 10bv64, true; @@ -421,7 +421,7 @@ procedure main() call printf(); goto l00000370; l00000370: - assume {:captureState "addr:l00000370"} true; + assume {:captureState "l00000370"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/malloc_with_local3/clang_no_plt_no_pic/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/clang_no_plt_no_pic/malloc_with_local3.expected index 5aae86cb6..4e8f07b3e 100644 --- a/src/test/correct/malloc_with_local3/clang_no_plt_no_pic/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/clang_no_plt_no_pic/malloc_with_local3.expected @@ -1,84 +1,84 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2344bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,9 +194,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -638,7 +638,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#7: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -656,7 +656,7 @@ procedure main() call malloc(); goto l00000c74; l00000c74: - assume {:captureState "addr:l00000c74"} true; + assume {:captureState "l00000c74"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R29, 18446744073709551600bv64), R0), gamma_store64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64), Gamma_R0); assume {:captureState "%00000c7a"} true; R8, Gamma_R8 := 11bv64, true; @@ -669,7 +669,7 @@ procedure main() call malloc(); goto l00000c9d; l00000c9d: - assume {:captureState "addr:l00000c9d"} true; + assume {:captureState "l00000c9d"} true; R8, Gamma_R8 := R0, Gamma_R0; R0, Gamma_R0 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R8); @@ -681,7 +681,7 @@ procedure main() call malloc(); goto l00000cc6; l00000cc6: - assume {:captureState "addr:l00000cc6"} true; + assume {:captureState "l00000cc6"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); assume {:captureState "%00000ccc"} true; R8, Gamma_R8 := 9bv64, true; @@ -704,7 +704,7 @@ procedure main() call printCharValue(); goto l00000d8f; l00000d8f: - assume {:captureState "addr:l00000d8f"} true; + assume {:captureState "l00000d8f"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -714,7 +714,7 @@ procedure main() call printf(); goto l00000daf; l00000daf: - assume {:captureState "addr:l00000daf"} true; + assume {:captureState "l00000daf"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2364bv64), Gamma_R0; @@ -722,19 +722,19 @@ procedure main() call printf(); goto l00000dc8; l00000dc8: - assume {:captureState "addr:l00000dc8"} true; + assume {:captureState "l00000dc8"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2236bv64, true; call #free(); goto l00000dd7; l00000dd7: - assume {:captureState "addr:l00000dd7"} true; + assume {:captureState "l00000dd7"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2244bv64, true; call #free(); goto l00000de5; l00000de5: - assume {:captureState "addr:l00000de5"} true; + assume {:captureState "l00000de5"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #7, Gamma_#7 := bvadd64(R31, 64bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #7), gamma_load64(Gamma_stack, #7); @@ -1166,7 +1166,7 @@ procedure printCharValue() var Gamma_#5: bool; var Gamma_#6: bool; lprintCharValue: - assume {:captureState "addr:lprintCharValue"} true; + assume {:captureState "lprintCharValue"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); @@ -1193,7 +1193,7 @@ procedure printCharValue() call printf(); goto l00000d74; l00000d74: - assume {:captureState "addr:l00000d74"} true; + assume {:captureState "l00000d74"} true; #6, Gamma_#6 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #6), gamma_load64(Gamma_stack, #6); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(#6, 8bv64)), gamma_load64(Gamma_stack, bvadd64(#6, 8bv64)); diff --git a/src/test/correct/malloc_with_local3/clang_pic/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/clang_pic/malloc_with_local3.expected index 5aae86cb6..4e8f07b3e 100644 --- a/src/test/correct/malloc_with_local3/clang_pic/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/clang_pic/malloc_with_local3.expected @@ -1,84 +1,84 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2344bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,7 +185,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -194,9 +194,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -638,7 +638,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#7: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551536bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 64bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -656,7 +656,7 @@ procedure main() call malloc(); goto l00000c74; l00000c74: - assume {:captureState "addr:l00000c74"} true; + assume {:captureState "l00000c74"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R29, 18446744073709551600bv64), R0), gamma_store64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64), Gamma_R0); assume {:captureState "%00000c7a"} true; R8, Gamma_R8 := 11bv64, true; @@ -669,7 +669,7 @@ procedure main() call malloc(); goto l00000c9d; l00000c9d: - assume {:captureState "addr:l00000c9d"} true; + assume {:captureState "l00000c9d"} true; R8, Gamma_R8 := R0, Gamma_R0; R0, Gamma_R0 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 32bv64), R8), gamma_store64(Gamma_stack, bvadd64(R31, 32bv64), Gamma_R8); @@ -681,7 +681,7 @@ procedure main() call malloc(); goto l00000cc6; l00000cc6: - assume {:captureState "addr:l00000cc6"} true; + assume {:captureState "l00000cc6"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); assume {:captureState "%00000ccc"} true; R8, Gamma_R8 := 9bv64, true; @@ -704,7 +704,7 @@ procedure main() call printCharValue(); goto l00000d8f; l00000d8f: - assume {:captureState "addr:l00000d8f"} true; + assume {:captureState "l00000d8f"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -714,7 +714,7 @@ procedure main() call printf(); goto l00000daf; l00000daf: - assume {:captureState "addr:l00000daf"} true; + assume {:captureState "l00000daf"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2364bv64), Gamma_R0; @@ -722,19 +722,19 @@ procedure main() call printf(); goto l00000dc8; l00000dc8: - assume {:captureState "addr:l00000dc8"} true; + assume {:captureState "l00000dc8"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R29, 18446744073709551600bv64)), gamma_load64(Gamma_stack, bvadd64(R29, 18446744073709551600bv64)); R30, Gamma_R30 := 2236bv64, true; call #free(); goto l00000dd7; l00000dd7: - assume {:captureState "addr:l00000dd7"} true; + assume {:captureState "l00000dd7"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 32bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 32bv64)); R30, Gamma_R30 := 2244bv64, true; call #free(); goto l00000de5; l00000de5: - assume {:captureState "addr:l00000de5"} true; + assume {:captureState "l00000de5"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #7, Gamma_#7 := bvadd64(R31, 64bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #7), gamma_load64(Gamma_stack, #7); @@ -1166,7 +1166,7 @@ procedure printCharValue() var Gamma_#5: bool; var Gamma_#6: bool; lprintCharValue: - assume {:captureState "addr:lprintCharValue"} true; + assume {:captureState "lprintCharValue"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; #5, Gamma_#5 := bvadd64(R31, 16bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); @@ -1193,7 +1193,7 @@ procedure printCharValue() call printf(); goto l00000d74; l00000d74: - assume {:captureState "addr:l00000d74"} true; + assume {:captureState "l00000d74"} true; #6, Gamma_#6 := bvadd64(R31, 16bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #6), gamma_load64(Gamma_stack, #6); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(#6, 8bv64)), gamma_load64(Gamma_stack, bvadd64(#6, 8bv64)); diff --git a/src/test/correct/malloc_with_local3/gcc/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/gcc/malloc_with_local3.expected index d42093c1c..84eaf0dd9 100644 --- a/src/test/correct/malloc_with_local3/gcc/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/gcc/malloc_with_local3.expected @@ -1,80 +1,80 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2328bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -190,7 +190,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -199,9 +199,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -677,7 +677,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%000003a4"} true; @@ -690,7 +690,7 @@ procedure main() call malloc(); goto l000003c3; l000003c3: - assume {:captureState "addr:l000003c3"} true; + assume {:captureState "l000003c3"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); assume {:captureState "%000003c9"} true; R0, Gamma_R0 := 11bv64, true; @@ -701,7 +701,7 @@ procedure main() call malloc(); goto l000003e4; l000003e4: - assume {:captureState "addr:l000003e4"} true; + assume {:captureState "l000003e4"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 48bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 48bv64), Gamma_R0); assume {:captureState "%000003ea"} true; R0, Gamma_R0 := 10bv64, true; @@ -712,7 +712,7 @@ procedure main() call malloc(); goto l00000405; l00000405: - assume {:captureState "addr:l00000405"} true; + assume {:captureState "l00000405"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 56bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 56bv64), Gamma_R0); assume {:captureState "%0000040b"} true; R0, Gamma_R0 := 9bv64, true; @@ -735,7 +735,7 @@ procedure main() call printCharValue(); goto l000004db; l000004db: - assume {:captureState "addr:l000004db"} true; + assume {:captureState "l000004db"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -746,7 +746,7 @@ procedure main() call printf(); goto l00000501; l00000501: - assume {:captureState "addr:l00000501"} true; + assume {:captureState "l00000501"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 32bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 32bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2352bv64), Gamma_R0; @@ -754,19 +754,19 @@ procedure main() call printf(); goto l0000051a; l0000051a: - assume {:captureState "addr:l0000051a"} true; + assume {:captureState "l0000051a"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2216bv64, true; call #free(); goto l00000529; l00000529: - assume {:captureState "addr:l00000529"} true; + assume {:captureState "l00000529"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R30, Gamma_R30 := 2224bv64, true; call #free(); goto l00000537; l00000537: - assume {:captureState "addr:l00000537"} true; + assume {:captureState "l00000537"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -1231,7 +1231,7 @@ procedure printCharValue() var #5: bv64; var Gamma_#5: bool; lprintCharValue: - assume {:captureState "addr:lprintCharValue"} true; + assume {:captureState "lprintCharValue"} true; #5, Gamma_#5 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); assume {:captureState "%0000045a"} true; @@ -1261,7 +1261,7 @@ procedure printCharValue() call printf(); goto l000004c4; l000004c4: - assume {:captureState "addr:l000004c4"} true; + assume {:captureState "l000004c4"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; diff --git a/src/test/correct/malloc_with_local3/gcc_O2/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/gcc_O2/malloc_with_local3.expected index b7dd816ae..cb33d38b0 100644 --- a/src/test/correct/malloc_with_local3/gcc_O2/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/gcc_O2/malloc_with_local3.expected @@ -1,70 +1,70 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R19: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R3: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R19: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R3: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R19: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R3: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R19: bv64; +var {:extern} R2: bv64; +var {:extern} R29: bv64; +var {:extern} R3: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2264bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -176,7 +176,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -185,9 +185,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure __printf_chk(); @@ -866,7 +866,7 @@ procedure main() var #1: bv64; var Gamma_#1: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); assume {:captureState "%00000222"} true; @@ -881,7 +881,7 @@ procedure main() call malloc(); goto l00000249; l00000249: - assume {:captureState "addr:l00000249"} true; + assume {:captureState "l00000249"} true; R1, Gamma_R1 := 65bv64, true; call rely(); assert (L(mem, R0) ==> Gamma_R1); @@ -892,7 +892,7 @@ procedure main() call printCharValue(); goto l0000029a; l0000029a: - assume {:captureState "addr:l0000029a"} true; + assume {:captureState "l0000029a"} true; R2, Gamma_R2 := 42bv64, true; R1, Gamma_R1 := 0bv64, true; R0, Gamma_R0 := 1bv64, true; @@ -901,7 +901,7 @@ procedure main() call __printf_chk(); goto l000002b6; l000002b6: - assume {:captureState "addr:l000002b6"} true; + assume {:captureState "l000002b6"} true; R1, Gamma_R1 := 0bv64, true; R1, Gamma_R1 := bvadd64(R1, 2312bv64), Gamma_R1; R2, Gamma_R2 := 10bv64, true; @@ -910,13 +910,13 @@ procedure main() call __printf_chk(); goto l000002d2; l000002d2: - assume {:captureState "addr:l000002d2"} true; + assume {:captureState "l000002d2"} true; R0, Gamma_R0 := R19, Gamma_R19; R30, Gamma_R30 := 1876bv64, true; call #free(); goto l000002e0; l000002e0: - assume {:captureState "addr:l000002e0"} true; + assume {:captureState "l000002e0"} true; R0, Gamma_R0 := 0bv64, true; R19, Gamma_R19 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); @@ -1360,7 +1360,7 @@ procedure printCharValue() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lprintCharValue: - assume {:captureState "addr:lprintCharValue"} true; + assume {:captureState "lprintCharValue"} true; R3, Gamma_R3 := R0, Gamma_R0; R0, Gamma_R0 := 1bv64, true; R1, Gamma_R1 := 0bv64, true; diff --git a/src/test/correct/malloc_with_local3/gcc_no_plt_no_pic/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/gcc_no_plt_no_pic/malloc_with_local3.expected index d1c04e08d..5b5324742 100644 --- a/src/test/correct/malloc_with_local3/gcc_no_plt_no_pic/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/gcc_no_plt_no_pic/malloc_with_local3.expected @@ -1,80 +1,80 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2328bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -190,7 +190,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -199,9 +199,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -677,7 +677,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000c00"} true; @@ -690,7 +690,7 @@ procedure main() call malloc(); goto l00000c1f; l00000c1f: - assume {:captureState "addr:l00000c1f"} true; + assume {:captureState "l00000c1f"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); assume {:captureState "%00000c25"} true; R0, Gamma_R0 := 11bv64, true; @@ -701,7 +701,7 @@ procedure main() call malloc(); goto l00000c40; l00000c40: - assume {:captureState "addr:l00000c40"} true; + assume {:captureState "l00000c40"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 48bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 48bv64), Gamma_R0); assume {:captureState "%00000c46"} true; R0, Gamma_R0 := 10bv64, true; @@ -712,7 +712,7 @@ procedure main() call malloc(); goto l00000c61; l00000c61: - assume {:captureState "addr:l00000c61"} true; + assume {:captureState "l00000c61"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 56bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 56bv64), Gamma_R0); assume {:captureState "%00000c67"} true; R0, Gamma_R0 := 9bv64, true; @@ -735,7 +735,7 @@ procedure main() call printCharValue(); goto l00000d37; l00000d37: - assume {:captureState "addr:l00000d37"} true; + assume {:captureState "l00000d37"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -746,7 +746,7 @@ procedure main() call printf(); goto l00000d5d; l00000d5d: - assume {:captureState "addr:l00000d5d"} true; + assume {:captureState "l00000d5d"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 32bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 32bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2352bv64), Gamma_R0; @@ -754,19 +754,19 @@ procedure main() call printf(); goto l00000d76; l00000d76: - assume {:captureState "addr:l00000d76"} true; + assume {:captureState "l00000d76"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2216bv64, true; call #free(); goto l00000d85; l00000d85: - assume {:captureState "addr:l00000d85"} true; + assume {:captureState "l00000d85"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R30, Gamma_R30 := 2224bv64, true; call #free(); goto l00000d93; l00000d93: - assume {:captureState "addr:l00000d93"} true; + assume {:captureState "l00000d93"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -1231,7 +1231,7 @@ procedure printCharValue() var #5: bv64; var Gamma_#5: bool; lprintCharValue: - assume {:captureState "addr:lprintCharValue"} true; + assume {:captureState "lprintCharValue"} true; #5, Gamma_#5 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); assume {:captureState "%00000cb6"} true; @@ -1261,7 +1261,7 @@ procedure printCharValue() call printf(); goto l00000d20; l00000d20: - assume {:captureState "addr:l00000d20"} true; + assume {:captureState "l00000d20"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; diff --git a/src/test/correct/malloc_with_local3/gcc_pic/malloc_with_local3.expected b/src/test/correct/malloc_with_local3/gcc_pic/malloc_with_local3.expected index d1c04e08d..5b5324742 100644 --- a/src/test/correct/malloc_with_local3/gcc_pic/malloc_with_local3.expected +++ b/src/test/correct/malloc_with_local3/gcc_pic/malloc_with_local3.expected @@ -1,80 +1,80 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2328bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -190,7 +190,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -199,9 +199,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -677,7 +677,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551552bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000c00"} true; @@ -690,7 +690,7 @@ procedure main() call malloc(); goto l00000c1f; l00000c1f: - assume {:captureState "addr:l00000c1f"} true; + assume {:captureState "l00000c1f"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 40bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 40bv64), Gamma_R0); assume {:captureState "%00000c25"} true; R0, Gamma_R0 := 11bv64, true; @@ -701,7 +701,7 @@ procedure main() call malloc(); goto l00000c40; l00000c40: - assume {:captureState "addr:l00000c40"} true; + assume {:captureState "l00000c40"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 48bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 48bv64), Gamma_R0); assume {:captureState "%00000c46"} true; R0, Gamma_R0 := 10bv64, true; @@ -712,7 +712,7 @@ procedure main() call malloc(); goto l00000c61; l00000c61: - assume {:captureState "addr:l00000c61"} true; + assume {:captureState "l00000c61"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 56bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 56bv64), Gamma_R0); assume {:captureState "%00000c67"} true; R0, Gamma_R0 := 9bv64, true; @@ -735,7 +735,7 @@ procedure main() call printCharValue(); goto l00000d37; l00000d37: - assume {:captureState "addr:l00000d37"} true; + assume {:captureState "l00000d37"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -746,7 +746,7 @@ procedure main() call printf(); goto l00000d5d; l00000d5d: - assume {:captureState "addr:l00000d5d"} true; + assume {:captureState "l00000d5d"} true; R1, Gamma_R1 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 32bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 32bv64)); R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 2352bv64), Gamma_R0; @@ -754,19 +754,19 @@ procedure main() call printf(); goto l00000d76; l00000d76: - assume {:captureState "addr:l00000d76"} true; + assume {:captureState "l00000d76"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 40bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 40bv64)); R30, Gamma_R30 := 2216bv64, true; call #free(); goto l00000d85; l00000d85: - assume {:captureState "addr:l00000d85"} true; + assume {:captureState "l00000d85"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 48bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 48bv64)); R30, Gamma_R30 := 2224bv64, true; call #free(); goto l00000d93; l00000d93: - assume {:captureState "addr:l00000d93"} true; + assume {:captureState "l00000d93"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); @@ -1231,7 +1231,7 @@ procedure printCharValue() var #5: bv64; var Gamma_#5: bool; lprintCharValue: - assume {:captureState "addr:lprintCharValue"} true; + assume {:captureState "lprintCharValue"} true; #5, Gamma_#5 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #5, R29), gamma_store64(Gamma_stack, #5, Gamma_R29); assume {:captureState "%00000cb6"} true; @@ -1261,7 +1261,7 @@ procedure printCharValue() call printf(); goto l00000d20; l00000d20: - assume {:captureState "addr:l00000d20"} true; + assume {:captureState "l00000d20"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; diff --git a/src/test/correct/multi_malloc/clang/multi_malloc.expected b/src/test/correct/multi_malloc/clang/multi_malloc.expected index bfc6dccdd..829a6b1d3 100644 --- a/src/test/correct/multi_malloc/clang/multi_malloc.expected +++ b/src/test/correct/multi_malloc/clang/multi_malloc.expected @@ -1,83 +1,83 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2232bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -151,7 +151,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -160,9 +160,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -472,7 +472,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -490,7 +490,7 @@ procedure main() call malloc(); goto l00000379; l00000379: - assume {:captureState "addr:l00000379"} true; + assume {:captureState "l00000379"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); assume {:captureState "%0000037f"} true; R0, Gamma_R0 := 4bv64, true; @@ -498,7 +498,7 @@ procedure main() call malloc(); goto l0000038d; l0000038d: - assume {:captureState "addr:l0000038d"} true; + assume {:captureState "l0000038d"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); assume {:captureState "%00000393"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); @@ -522,7 +522,7 @@ procedure main() call printf(); goto l000003de; l000003de: - assume {:captureState "addr:l000003de"} true; + assume {:captureState "l000003de"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -532,19 +532,19 @@ procedure main() call printf(); goto l000003fe; l000003fe: - assume {:captureState "addr:l000003fe"} true; + assume {:captureState "l000003fe"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2188bv64, true; call #free(); goto l0000040d; l0000040d: - assume {:captureState "addr:l0000040d"} true; + assume {:captureState "l0000040d"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2196bv64, true; call #free(); goto l0000041b; l0000041b: - assume {:captureState "addr:l0000041b"} true; + assume {:captureState "l0000041b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/multi_malloc/clang_O2/multi_malloc.expected b/src/test/correct/multi_malloc/clang_O2/multi_malloc.expected index 6837f9a9c..d1762ce6b 100644 --- a/src/test/correct/multi_malloc/clang_O2/multi_malloc.expected +++ b/src/test/correct/multi_malloc/clang_O2/multi_malloc.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1948bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -113,7 +113,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -122,9 +122,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -291,7 +291,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%000002e8"} true; @@ -306,7 +306,7 @@ procedure main() call printf(); goto l00000312; l00000312: - assume {:captureState "addr:l00000312"} true; + assume {:captureState "l00000312"} true; R0, Gamma_R0 := 0bv64, true; R0, Gamma_R0 := bvadd64(R0, 1969bv64), Gamma_R0; R1, Gamma_R1 := 42bv64, true; @@ -314,7 +314,7 @@ procedure main() call printf(); goto l00000329; l00000329: - assume {:captureState "addr:l00000329"} true; + assume {:captureState "l00000329"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/multi_malloc/clang_no_plt_no_pic/multi_malloc.expected b/src/test/correct/multi_malloc/clang_no_plt_no_pic/multi_malloc.expected index 0bd9b5530..002ba1344 100644 --- a/src/test/correct/multi_malloc/clang_no_plt_no_pic/multi_malloc.expected +++ b/src/test/correct/multi_malloc/clang_no_plt_no_pic/multi_malloc.expected @@ -1,83 +1,83 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2232bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -151,7 +151,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -160,9 +160,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -472,7 +472,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -490,7 +490,7 @@ procedure main() call malloc(); goto l00000aa7; l00000aa7: - assume {:captureState "addr:l00000aa7"} true; + assume {:captureState "l00000aa7"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); assume {:captureState "%00000aad"} true; R0, Gamma_R0 := 4bv64, true; @@ -498,7 +498,7 @@ procedure main() call malloc(); goto l00000abb; l00000abb: - assume {:captureState "addr:l00000abb"} true; + assume {:captureState "l00000abb"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); assume {:captureState "%00000ac1"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); @@ -522,7 +522,7 @@ procedure main() call printf(); goto l00000b0c; l00000b0c: - assume {:captureState "addr:l00000b0c"} true; + assume {:captureState "l00000b0c"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -532,19 +532,19 @@ procedure main() call printf(); goto l00000b2c; l00000b2c: - assume {:captureState "addr:l00000b2c"} true; + assume {:captureState "l00000b2c"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2188bv64, true; call #free(); goto l00000b3b; l00000b3b: - assume {:captureState "addr:l00000b3b"} true; + assume {:captureState "l00000b3b"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2196bv64, true; call #free(); goto l00000b49; l00000b49: - assume {:captureState "addr:l00000b49"} true; + assume {:captureState "l00000b49"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/multi_malloc/clang_pic/multi_malloc.expected b/src/test/correct/multi_malloc/clang_pic/multi_malloc.expected index 0bd9b5530..002ba1344 100644 --- a/src/test/correct/multi_malloc/clang_pic/multi_malloc.expected +++ b/src/test/correct/multi_malloc/clang_pic/multi_malloc.expected @@ -1,83 +1,83 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2232bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -151,7 +151,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69702bv64) == 0bv8); free ensures (memory_load8_le(mem, 69703bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -160,9 +160,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -472,7 +472,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -490,7 +490,7 @@ procedure main() call malloc(); goto l00000aa7; l00000aa7: - assume {:captureState "addr:l00000aa7"} true; + assume {:captureState "l00000aa7"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); assume {:captureState "%00000aad"} true; R0, Gamma_R0 := 4bv64, true; @@ -498,7 +498,7 @@ procedure main() call malloc(); goto l00000abb; l00000abb: - assume {:captureState "addr:l00000abb"} true; + assume {:captureState "l00000abb"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 8bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); assume {:captureState "%00000ac1"} true; R9, Gamma_R9 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); @@ -522,7 +522,7 @@ procedure main() call printf(); goto l00000b0c; l00000b0c: - assume {:captureState "addr:l00000b0c"} true; + assume {:captureState "l00000b0c"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R1, Gamma_R1 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -532,19 +532,19 @@ procedure main() call printf(); goto l00000b2c; l00000b2c: - assume {:captureState "addr:l00000b2c"} true; + assume {:captureState "l00000b2c"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2188bv64, true; call #free(); goto l00000b3b; l00000b3b: - assume {:captureState "addr:l00000b3b"} true; + assume {:captureState "l00000b3b"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R30, Gamma_R30 := 2196bv64, true; call #free(); goto l00000b49; l00000b49: - assume {:captureState "addr:l00000b49"} true; + assume {:captureState "l00000b49"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #5, Gamma_#5 := bvadd64(R31, 32bv64), Gamma_R31; R29, Gamma_R29 := memory_load64_le(stack, #5), gamma_load64(Gamma_stack, #5); diff --git a/src/test/correct/multi_malloc/gcc/multi_malloc.expected b/src/test/correct/multi_malloc/gcc/multi_malloc.expected index 8d5d8855b..183a05c34 100644 --- a/src/test/correct/multi_malloc/gcc/multi_malloc.expected +++ b/src/test/correct/multi_malloc/gcc/multi_malloc.expected @@ -1,79 +1,79 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2224bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -158,7 +158,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -167,9 +167,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -521,7 +521,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000338"} true; @@ -534,7 +534,7 @@ procedure main() call malloc(); goto l00000357; l00000357: - assume {:captureState "addr:l00000357"} true; + assume {:captureState "l00000357"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); assume {:captureState "%0000035d"} true; R0, Gamma_R0 := 4bv64, true; @@ -542,7 +542,7 @@ procedure main() call malloc(); goto l0000036b; l0000036b: - assume {:captureState "addr:l0000036b"} true; + assume {:captureState "l0000036b"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); assume {:captureState "%00000371"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); @@ -567,7 +567,7 @@ procedure main() call printf(); goto l000003c2; l000003c2: - assume {:captureState "addr:l000003c2"} true; + assume {:captureState "l000003c2"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -578,19 +578,19 @@ procedure main() call printf(); goto l000003e8; l000003e8: - assume {:captureState "addr:l000003e8"} true; + assume {:captureState "l000003e8"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2180bv64, true; call #free(); goto l000003f7; l000003f7: - assume {:captureState "addr:l000003f7"} true; + assume {:captureState "l000003f7"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 2188bv64, true; call #free(); goto l00000405; l00000405: - assume {:captureState "addr:l00000405"} true; + assume {:captureState "l00000405"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/multi_malloc/gcc_O2/multi_malloc.expected b/src/test/correct/multi_malloc/gcc_O2/multi_malloc.expected index f780a9e26..4fa5bf17f 100644 --- a/src/test/correct/multi_malloc/gcc_O2/multi_malloc.expected +++ b/src/test/correct/multi_malloc/gcc_O2/multi_malloc.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R2: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R2: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2024bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -126,7 +126,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -135,9 +135,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure __printf_chk(); @@ -489,7 +489,7 @@ procedure main() var #1: bv64; var Gamma_#1: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #1, Gamma_#1 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #1, R29), gamma_store64(Gamma_stack, #1, Gamma_R29); assume {:captureState "%000001b2"} true; @@ -505,7 +505,7 @@ procedure main() call __printf_chk(); goto l000001e1; l000001e1: - assume {:captureState "addr:l000001e1"} true; + assume {:captureState "l000001e1"} true; R2, Gamma_R2 := 42bv64, true; R1, Gamma_R1 := 0bv64, true; R0, Gamma_R0 := 1bv64, true; @@ -514,7 +514,7 @@ procedure main() call __printf_chk(); goto l000001fd; l000001fd: - assume {:captureState "addr:l000001fd"} true; + assume {:captureState "l000001fd"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/multi_malloc/gcc_no_plt_no_pic/multi_malloc.expected b/src/test/correct/multi_malloc/gcc_no_plt_no_pic/multi_malloc.expected index 2590a4df1..417806157 100644 --- a/src/test/correct/multi_malloc/gcc_no_plt_no_pic/multi_malloc.expected +++ b/src/test/correct/multi_malloc/gcc_no_plt_no_pic/multi_malloc.expected @@ -1,79 +1,79 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2224bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -158,7 +158,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -167,9 +167,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -521,7 +521,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000a45"} true; @@ -534,7 +534,7 @@ procedure main() call malloc(); goto l00000a64; l00000a64: - assume {:captureState "addr:l00000a64"} true; + assume {:captureState "l00000a64"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); assume {:captureState "%00000a6a"} true; R0, Gamma_R0 := 4bv64, true; @@ -542,7 +542,7 @@ procedure main() call malloc(); goto l00000a78; l00000a78: - assume {:captureState "addr:l00000a78"} true; + assume {:captureState "l00000a78"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); assume {:captureState "%00000a7e"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); @@ -567,7 +567,7 @@ procedure main() call printf(); goto l00000acf; l00000acf: - assume {:captureState "addr:l00000acf"} true; + assume {:captureState "l00000acf"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -578,19 +578,19 @@ procedure main() call printf(); goto l00000af5; l00000af5: - assume {:captureState "addr:l00000af5"} true; + assume {:captureState "l00000af5"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2180bv64, true; call #free(); goto l00000b04; l00000b04: - assume {:captureState "addr:l00000b04"} true; + assume {:captureState "l00000b04"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 2188bv64, true; call #free(); goto l00000b12; l00000b12: - assume {:captureState "addr:l00000b12"} true; + assume {:captureState "l00000b12"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/multi_malloc/gcc_pic/multi_malloc.expected b/src/test/correct/multi_malloc/gcc_pic/multi_malloc.expected index 2590a4df1..417806157 100644 --- a/src/test/correct/multi_malloc/gcc_pic/multi_malloc.expected +++ b/src/test/correct/multi_malloc/gcc_pic/multi_malloc.expected @@ -1,79 +1,79 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 2224bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -158,7 +158,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -167,9 +167,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure #free(); @@ -521,7 +521,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000a45"} true; @@ -534,7 +534,7 @@ procedure main() call malloc(); goto l00000a64; l00000a64: - assume {:captureState "addr:l00000a64"} true; + assume {:captureState "l00000a64"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 16bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 16bv64), Gamma_R0); assume {:captureState "%00000a6a"} true; R0, Gamma_R0 := 4bv64, true; @@ -542,7 +542,7 @@ procedure main() call malloc(); goto l00000a78; l00000a78: - assume {:captureState "addr:l00000a78"} true; + assume {:captureState "l00000a78"} true; stack, Gamma_stack := memory_store64_le(stack, bvadd64(R31, 24bv64), R0), gamma_store64(Gamma_stack, bvadd64(R31, 24bv64), Gamma_R0); assume {:captureState "%00000a7e"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); @@ -567,7 +567,7 @@ procedure main() call printf(); goto l00000acf; l00000acf: - assume {:captureState "addr:l00000acf"} true; + assume {:captureState "l00000acf"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, R0)), (gamma_load32(Gamma_mem, R0) || L(mem, R0)); @@ -578,19 +578,19 @@ procedure main() call printf(); goto l00000af5; l00000af5: - assume {:captureState "addr:l00000af5"} true; + assume {:captureState "l00000af5"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 16bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 16bv64)); R30, Gamma_R30 := 2180bv64, true; call #free(); goto l00000b04; l00000b04: - assume {:captureState "addr:l00000b04"} true; + assume {:captureState "l00000b04"} true; R0, Gamma_R0 := memory_load64_le(stack, bvadd64(R31, 24bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 24bv64)); R30, Gamma_R30 := 2188bv64, true; call #free(); goto l00000b12; l00000b12: - assume {:captureState "addr:l00000b12"} true; + assume {:captureState "l00000b12"} true; R0, Gamma_R0 := 0bv64, true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); diff --git a/src/test/correct/nestedif/clang/nestedif.expected b/src/test/correct/nestedif/clang/nestedif.expected index 2087b50c5..15c499b19 100644 --- a/src/test/correct/nestedif/clang/nestedif.expected +++ b/src/test/correct/nestedif/clang/nestedif.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1968bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -203,7 +203,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%0000033d"} true; @@ -225,19 +225,22 @@ procedure main() } goto l0000037c; l0000037c: + assume {:captureState "l0000037c"} true; R8, Gamma_R8 := 1bv64, true; goto l0000037f; l00000379: + assume {:captureState "l00000379"} true; R8, Gamma_R8 := 0bv64, true; goto l0000037f; l0000037f: + assume {:captureState "l0000037f"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000387; } goto l00000442; l00000387: - assume {:captureState "addr:l00000387"} true; + assume {:captureState "l00000387"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R8[32:0], 4294967294bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934591bv33))), (Gamma_R8 && Gamma_#5); @@ -251,19 +254,22 @@ procedure main() } goto l000003b5; l000003b5: + assume {:captureState "l000003b5"} true; R8, Gamma_R8 := 1bv64, true; goto l000003b8; l000003b2: + assume {:captureState "l000003b2"} true; R8, Gamma_R8 := 0bv64, true; goto l000003b8; l000003b8: + assume {:captureState "l000003b8"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l000003c0; } goto l0000042d; l000003c0: - assume {:captureState "addr:l000003c0"} true; + assume {:captureState "l000003c0"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #6, Gamma_#6 := bvadd32(R8[32:0], 4294967293bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934590bv33))), (Gamma_R8 && Gamma_#6); @@ -277,52 +283,55 @@ procedure main() } goto l000003ee; l000003ee: + assume {:captureState "l000003ee"} true; R8, Gamma_R8 := 1bv64, true; goto l000003f1; l000003eb: + assume {:captureState "l000003eb"} true; R8, Gamma_R8 := 0bv64, true; goto l000003f1; l000003f1: + assume {:captureState "l000003f1"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l000003f9; } goto l00000418; l00000418: - assume {:captureState "addr:l00000418"} true; + assume {:captureState "l00000418"} true; goto l00000419; l00000419: - assume {:captureState "addr:l00000419"} true; + assume {:captureState "l00000419"} true; R8, Gamma_R8 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); assume {:captureState "%00000427"} true; goto l000003f9; l000003f9: - assume {:captureState "addr:l000003f9"} true; + assume {:captureState "l000003f9"} true; goto l000003ff; l0000042d: - assume {:captureState "addr:l0000042d"} true; + assume {:captureState "l0000042d"} true; goto l0000042e; l0000042e: - assume {:captureState "addr:l0000042e"} true; + assume {:captureState "l0000042e"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); assume {:captureState "%0000043c"} true; goto l000003ff; l000003ff: - assume {:captureState "addr:l000003ff"} true; + assume {:captureState "l000003ff"} true; goto l00000403; l00000442: - assume {:captureState "addr:l00000442"} true; + assume {:captureState "l00000442"} true; goto l00000443; l00000443: - assume {:captureState "addr:l00000443"} true; + assume {:captureState "l00000443"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); assume {:captureState "%00000451"} true; goto l00000403; l00000403: - assume {:captureState "addr:l00000403"} true; + assume {:captureState "l00000403"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/nestedif/clang_O2/nestedif.expected b/src/test/correct/nestedif/clang_O2/nestedif.expected index dfc8a4e7d..b904c03a5 100644 --- a/src/test/correct/nestedif/clang_O2/nestedif.expected +++ b/src/test/correct/nestedif/clang_O2/nestedif.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1840bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/nestedif/clang_no_plt_no_pic/nestedif.expected b/src/test/correct/nestedif/clang_no_plt_no_pic/nestedif.expected index b85515bb7..3ca99ae3f 100644 --- a/src/test/correct/nestedif/clang_no_plt_no_pic/nestedif.expected +++ b/src/test/correct/nestedif/clang_no_plt_no_pic/nestedif.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1968bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -203,7 +203,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000a6e"} true; @@ -225,19 +225,22 @@ procedure main() } goto l00000aad; l00000aad: + assume {:captureState "l00000aad"} true; R8, Gamma_R8 := 1bv64, true; goto l00000ab0; l00000aaa: + assume {:captureState "l00000aaa"} true; R8, Gamma_R8 := 0bv64, true; goto l00000ab0; l00000ab0: + assume {:captureState "l00000ab0"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000ab8; } goto l00000b73; l00000ab8: - assume {:captureState "addr:l00000ab8"} true; + assume {:captureState "l00000ab8"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R8[32:0], 4294967294bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934591bv33))), (Gamma_R8 && Gamma_#5); @@ -251,19 +254,22 @@ procedure main() } goto l00000ae6; l00000ae6: + assume {:captureState "l00000ae6"} true; R8, Gamma_R8 := 1bv64, true; goto l00000ae9; l00000ae3: + assume {:captureState "l00000ae3"} true; R8, Gamma_R8 := 0bv64, true; goto l00000ae9; l00000ae9: + assume {:captureState "l00000ae9"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000af1; } goto l00000b5e; l00000af1: - assume {:captureState "addr:l00000af1"} true; + assume {:captureState "l00000af1"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #6, Gamma_#6 := bvadd32(R8[32:0], 4294967293bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934590bv33))), (Gamma_R8 && Gamma_#6); @@ -277,52 +283,55 @@ procedure main() } goto l00000b1f; l00000b1f: + assume {:captureState "l00000b1f"} true; R8, Gamma_R8 := 1bv64, true; goto l00000b22; l00000b1c: + assume {:captureState "l00000b1c"} true; R8, Gamma_R8 := 0bv64, true; goto l00000b22; l00000b22: + assume {:captureState "l00000b22"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000b2a; } goto l00000b49; l00000b49: - assume {:captureState "addr:l00000b49"} true; + assume {:captureState "l00000b49"} true; goto l00000b4a; l00000b4a: - assume {:captureState "addr:l00000b4a"} true; + assume {:captureState "l00000b4a"} true; R8, Gamma_R8 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); assume {:captureState "%00000b58"} true; goto l00000b2a; l00000b2a: - assume {:captureState "addr:l00000b2a"} true; + assume {:captureState "l00000b2a"} true; goto l00000b30; l00000b5e: - assume {:captureState "addr:l00000b5e"} true; + assume {:captureState "l00000b5e"} true; goto l00000b5f; l00000b5f: - assume {:captureState "addr:l00000b5f"} true; + assume {:captureState "l00000b5f"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); assume {:captureState "%00000b6d"} true; goto l00000b30; l00000b30: - assume {:captureState "addr:l00000b30"} true; + assume {:captureState "l00000b30"} true; goto l00000b34; l00000b73: - assume {:captureState "addr:l00000b73"} true; + assume {:captureState "l00000b73"} true; goto l00000b74; l00000b74: - assume {:captureState "addr:l00000b74"} true; + assume {:captureState "l00000b74"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); assume {:captureState "%00000b82"} true; goto l00000b34; l00000b34: - assume {:captureState "addr:l00000b34"} true; + assume {:captureState "l00000b34"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/nestedif/clang_pic/nestedif.expected b/src/test/correct/nestedif/clang_pic/nestedif.expected index b85515bb7..3ca99ae3f 100644 --- a/src/test/correct/nestedif/clang_pic/nestedif.expected +++ b/src/test/correct/nestedif/clang_pic/nestedif.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1968bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -203,7 +203,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000a6e"} true; @@ -225,19 +225,22 @@ procedure main() } goto l00000aad; l00000aad: + assume {:captureState "l00000aad"} true; R8, Gamma_R8 := 1bv64, true; goto l00000ab0; l00000aaa: + assume {:captureState "l00000aaa"} true; R8, Gamma_R8 := 0bv64, true; goto l00000ab0; l00000ab0: + assume {:captureState "l00000ab0"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000ab8; } goto l00000b73; l00000ab8: - assume {:captureState "addr:l00000ab8"} true; + assume {:captureState "l00000ab8"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R8[32:0], 4294967294bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934591bv33))), (Gamma_R8 && Gamma_#5); @@ -251,19 +254,22 @@ procedure main() } goto l00000ae6; l00000ae6: + assume {:captureState "l00000ae6"} true; R8, Gamma_R8 := 1bv64, true; goto l00000ae9; l00000ae3: + assume {:captureState "l00000ae3"} true; R8, Gamma_R8 := 0bv64, true; goto l00000ae9; l00000ae9: + assume {:captureState "l00000ae9"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000af1; } goto l00000b5e; l00000af1: - assume {:captureState "addr:l00000af1"} true; + assume {:captureState "l00000af1"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #6, Gamma_#6 := bvadd32(R8[32:0], 4294967293bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934590bv33))), (Gamma_R8 && Gamma_#6); @@ -277,52 +283,55 @@ procedure main() } goto l00000b1f; l00000b1f: + assume {:captureState "l00000b1f"} true; R8, Gamma_R8 := 1bv64, true; goto l00000b22; l00000b1c: + assume {:captureState "l00000b1c"} true; R8, Gamma_R8 := 0bv64, true; goto l00000b22; l00000b22: + assume {:captureState "l00000b22"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000b2a; } goto l00000b49; l00000b49: - assume {:captureState "addr:l00000b49"} true; + assume {:captureState "l00000b49"} true; goto l00000b4a; l00000b4a: - assume {:captureState "addr:l00000b4a"} true; + assume {:captureState "l00000b4a"} true; R8, Gamma_R8 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); assume {:captureState "%00000b58"} true; goto l00000b2a; l00000b2a: - assume {:captureState "addr:l00000b2a"} true; + assume {:captureState "l00000b2a"} true; goto l00000b30; l00000b5e: - assume {:captureState "addr:l00000b5e"} true; + assume {:captureState "l00000b5e"} true; goto l00000b5f; l00000b5f: - assume {:captureState "addr:l00000b5f"} true; + assume {:captureState "l00000b5f"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); assume {:captureState "%00000b6d"} true; goto l00000b30; l00000b30: - assume {:captureState "addr:l00000b30"} true; + assume {:captureState "l00000b30"} true; goto l00000b34; l00000b73: - assume {:captureState "addr:l00000b73"} true; + assume {:captureState "l00000b73"} true; goto l00000b74; l00000b74: - assume {:captureState "addr:l00000b74"} true; + assume {:captureState "l00000b74"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); assume {:captureState "%00000b82"} true; goto l00000b34; l00000b34: - assume {:captureState "addr:l00000b34"} true; + assume {:captureState "l00000b34"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/nestedif/gcc/nestedif.expected b/src/test/correct/nestedif/gcc/nestedif.expected index ac520a132..a2b195685 100644 --- a/src/test/correct/nestedif/gcc/nestedif.expected +++ b/src/test/correct/nestedif/gcc/nestedif.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1928bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -201,7 +201,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); @@ -220,7 +220,7 @@ procedure main() } goto l000003c4; l00000345: - assume {:captureState "addr:l00000345"} true; + assume {:captureState "l00000345"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#5); @@ -233,7 +233,7 @@ procedure main() } goto l000003b3; l0000036b: - assume {:captureState "addr:l0000036b"} true; + assume {:captureState "l0000036b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#6); @@ -246,25 +246,25 @@ procedure main() } goto l000003a6; l000003a6: - assume {:captureState "addr:l000003a6"} true; + assume {:captureState "l000003a6"} true; R0, Gamma_R0 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000003b1"} true; goto l00000391; l000003b3: - assume {:captureState "addr:l000003b3"} true; + assume {:captureState "l000003b3"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000003be"} true; goto l00000391; l000003c4: - assume {:captureState "addr:l000003c4"} true; + assume {:captureState "l000003c4"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000003cf"} true; goto l00000391; l00000391: - assume {:captureState "addr:l00000391"} true; + assume {:captureState "l00000391"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/nestedif/gcc_O2/nestedif.expected b/src/test/correct/nestedif/gcc_O2/nestedif.expected index db578d839..306991d20 100644 --- a/src/test/correct/nestedif/gcc_O2/nestedif.expected +++ b/src/test/correct/nestedif/gcc_O2/nestedif.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1896bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/nestedif/gcc_no_plt_no_pic/nestedif.expected b/src/test/correct/nestedif/gcc_no_plt_no_pic/nestedif.expected index d94363d97..0f2d64903 100644 --- a/src/test/correct/nestedif/gcc_no_plt_no_pic/nestedif.expected +++ b/src/test/correct/nestedif/gcc_no_plt_no_pic/nestedif.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1928bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -201,7 +201,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); @@ -220,7 +220,7 @@ procedure main() } goto l00000a60; l000009e1: - assume {:captureState "addr:l000009e1"} true; + assume {:captureState "l000009e1"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#5); @@ -233,7 +233,7 @@ procedure main() } goto l00000a4f; l00000a07: - assume {:captureState "addr:l00000a07"} true; + assume {:captureState "l00000a07"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#6); @@ -246,25 +246,25 @@ procedure main() } goto l00000a42; l00000a42: - assume {:captureState "addr:l00000a42"} true; + assume {:captureState "l00000a42"} true; R0, Gamma_R0 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000a4d"} true; goto l00000a2d; l00000a4f: - assume {:captureState "addr:l00000a4f"} true; + assume {:captureState "l00000a4f"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000a5a"} true; goto l00000a2d; l00000a60: - assume {:captureState "addr:l00000a60"} true; + assume {:captureState "l00000a60"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000a6b"} true; goto l00000a2d; l00000a2d: - assume {:captureState "addr:l00000a2d"} true; + assume {:captureState "l00000a2d"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/nestedif/gcc_pic/nestedif.expected b/src/test/correct/nestedif/gcc_pic/nestedif.expected index d94363d97..0f2d64903 100644 --- a/src/test/correct/nestedif/gcc_pic/nestedif.expected +++ b/src/test/correct/nestedif/gcc_pic/nestedif.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1928bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -201,7 +201,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); @@ -220,7 +220,7 @@ procedure main() } goto l00000a60; l000009e1: - assume {:captureState "addr:l000009e1"} true; + assume {:captureState "l000009e1"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#5); @@ -233,7 +233,7 @@ procedure main() } goto l00000a4f; l00000a07: - assume {:captureState "addr:l00000a07"} true; + assume {:captureState "l00000a07"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#6); @@ -246,25 +246,25 @@ procedure main() } goto l00000a42; l00000a42: - assume {:captureState "addr:l00000a42"} true; + assume {:captureState "l00000a42"} true; R0, Gamma_R0 := 7bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000a4d"} true; goto l00000a2d; l00000a4f: - assume {:captureState "addr:l00000a4f"} true; + assume {:captureState "l00000a4f"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000a5a"} true; goto l00000a2d; l00000a60: - assume {:captureState "addr:l00000a60"} true; + assume {:captureState "l00000a60"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000a6b"} true; goto l00000a2d; l00000a2d: - assume {:captureState "addr:l00000a2d"} true; + assume {:captureState "l00000a2d"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/no_interference_update_x/clang/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/clang/no_interference_update_x.expected index 3d075bbc1..7a6a27fd0 100644 --- a/src/test/correct/no_interference_update_x/clang/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/clang/no_interference_update_x.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -80,12 +80,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); @@ -185,7 +185,7 @@ procedure main() { var y_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); diff --git a/src/test/correct/no_interference_update_x/clang_O2/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/clang_O2/no_interference_update_x.expected index 05dd01c87..740a585c8 100644 --- a/src/test/correct/no_interference_update_x/clang_O2/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/clang_O2/no_interference_update_x.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -80,12 +80,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); @@ -185,7 +185,7 @@ procedure main() { var y_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/no_interference_update_x/clang_no_plt_no_pic/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/clang_no_plt_no_pic/no_interference_update_x.expected index 6ea1581ee..293d1dbc9 100644 --- a/src/test/correct/no_interference_update_x/clang_no_plt_no_pic/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/clang_no_plt_no_pic/no_interference_update_x.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -80,12 +80,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); @@ -185,7 +185,7 @@ procedure main() { var y_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); diff --git a/src/test/correct/no_interference_update_x/clang_pic/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/clang_pic/no_interference_update_x.expected index cc0e9e8c1..a5a054cf9 100644 --- a/src/test/correct/no_interference_update_x/clang_pic/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/clang_pic/no_interference_update_x.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -88,7 +88,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -96,12 +96,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); @@ -217,7 +217,7 @@ procedure main() { var y_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); diff --git a/src/test/correct/no_interference_update_x/gcc/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/gcc/no_interference_update_x.expected index 976c54ca5..48ecd68b7 100644 --- a/src/test/correct/no_interference_update_x/gcc/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/gcc/no_interference_update_x.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -78,12 +78,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); @@ -183,7 +183,7 @@ procedure main() { var y_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; diff --git a/src/test/correct/no_interference_update_x/gcc_O2/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/gcc_O2/no_interference_update_x.expected index 95c686547..ef1344e1e 100644 --- a/src/test/correct/no_interference_update_x/gcc_O2/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/gcc_O2/no_interference_update_x.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -80,12 +80,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); @@ -185,7 +185,7 @@ procedure main() { var y_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 1bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/no_interference_update_x/gcc_no_plt_no_pic/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/gcc_no_plt_no_pic/no_interference_update_x.expected index 477cd0244..09a38ab49 100644 --- a/src/test/correct/no_interference_update_x/gcc_no_plt_no_pic/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/gcc_no_plt_no_pic/no_interference_update_x.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -78,12 +78,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); @@ -183,7 +183,7 @@ procedure main() { var y_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; diff --git a/src/test/correct/no_interference_update_x/gcc_pic/no_interference_update_x.expected b/src/test/correct/no_interference_update_x/gcc_pic/no_interference_update_x.expected index 3b9db6a24..b07082212 100644 --- a/src/test/correct/no_interference_update_x/gcc_pic/no_interference_update_x.expected +++ b/src/test/correct/no_interference_update_x/gcc_pic/no_interference_update_x.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -86,7 +86,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -94,12 +94,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); @@ -215,7 +215,7 @@ procedure main() { var y_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); diff --git a/src/test/correct/no_interference_update_y/clang/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/clang/no_interference_update_y.expected index 2f031f723..2bb856649 100644 --- a/src/test/correct/no_interference_update_y/clang/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/clang/no_interference_update_y.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -80,12 +80,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -185,7 +185,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); diff --git a/src/test/correct/no_interference_update_y/clang_O2/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/clang_O2/no_interference_update_y.expected index e2265a10a..81e2f7c66 100644 --- a/src/test/correct/no_interference_update_y/clang_O2/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/clang_O2/no_interference_update_y.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -80,12 +80,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -185,7 +185,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/no_interference_update_y/clang_no_plt_no_pic/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/clang_no_plt_no_pic/no_interference_update_y.expected index 100fbb2a8..ac0a8d545 100644 --- a/src/test/correct/no_interference_update_y/clang_no_plt_no_pic/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/clang_no_plt_no_pic/no_interference_update_y.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -80,12 +80,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -185,7 +185,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); diff --git a/src/test/correct/no_interference_update_y/clang_pic/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/clang_pic/no_interference_update_y.expected index c2ed7684d..963551bd0 100644 --- a/src/test/correct/no_interference_update_y/clang_pic/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/clang_pic/no_interference_update_y.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -88,7 +88,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -96,12 +96,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -217,7 +217,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4048bv64)) || L(mem, bvadd64(R9, 4048bv64))); diff --git a/src/test/correct/no_interference_update_y/gcc/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/gcc/no_interference_update_y.expected index f860c613f..20a7bf882 100644 --- a/src/test/correct/no_interference_update_y/gcc/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/gcc/no_interference_update_y.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -78,12 +78,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -183,7 +183,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; diff --git a/src/test/correct/no_interference_update_y/gcc_O2/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/gcc_O2/no_interference_update_y.expected index 5933f7204..01c79156a 100644 --- a/src/test/correct/no_interference_update_y/gcc_O2/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/gcc_O2/no_interference_update_y.expected @@ -1,37 +1,37 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69656bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -72,7 +72,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -80,12 +80,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -185,7 +185,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 1bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/no_interference_update_y/gcc_no_plt_no_pic/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/gcc_no_plt_no_pic/no_interference_update_y.expected index 4b982d936..658b4eb22 100644 --- a/src/test/correct/no_interference_update_y/gcc_no_plt_no_pic/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/gcc_no_plt_no_pic/no_interference_update_y.expected @@ -1,35 +1,35 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -70,7 +70,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -78,12 +78,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -183,7 +183,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; diff --git a/src/test/correct/no_interference_update_y/gcc_pic/no_interference_update_y.expected b/src/test/correct/no_interference_update_y/gcc_pic/no_interference_update_y.expected index 93d1df00e..0cd4b1423 100644 --- a/src/test/correct/no_interference_update_y/gcc_pic/no_interference_update_y.expected +++ b/src/test/correct/no_interference_update_y/gcc_pic/no_interference_update_y.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $y_addr: bv64; +const {:extern} $y_addr: bv64; axiom ($y_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $y_addr) then true else (if (index == $x_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); @@ -86,7 +86,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $y_addr) == old(memory_load32_le(mem, $y_addr))); { @@ -94,12 +94,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $y_addr) == memory_load32_le(mem, $y_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); @@ -215,7 +215,7 @@ procedure main() { var x_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); diff --git a/src/test/correct/secret_write/clang/secret_write.expected b/src/test/correct/secret_write/clang/secret_write.expected index 1d4b7703e..731e47319 100644 --- a/src/test/correct/secret_write/clang/secret_write.expected +++ b/src/test/correct/secret_write/clang/secret_write.expected @@ -1,49 +1,49 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69688bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69692bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern} {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -94,13 +94,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); @@ -204,7 +204,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); diff --git a/src/test/correct/secret_write/clang_O2/secret_write.expected b/src/test/correct/secret_write/clang_O2/secret_write.expected index b43c831f2..0adc7d048 100644 --- a/src/test/correct/secret_write/clang_O2/secret_write.expected +++ b/src/test/correct/secret_write/clang_O2/secret_write.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69688bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69692bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern} {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -92,13 +92,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); @@ -202,7 +202,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 0bv64, true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; diff --git a/src/test/correct/secret_write/clang_no_plt_no_pic/secret_write.expected b/src/test/correct/secret_write/clang_no_plt_no_pic/secret_write.expected index d90604b7c..2e4c0f4d2 100644 --- a/src/test/correct/secret_write/clang_no_plt_no_pic/secret_write.expected +++ b/src/test/correct/secret_write/clang_no_plt_no_pic/secret_write.expected @@ -1,49 +1,49 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69688bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69692bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern} {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -94,13 +94,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); @@ -204,7 +204,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; call rely(); diff --git a/src/test/correct/secret_write/clang_pic/secret_write.expected b/src/test/correct/secret_write/clang_pic/secret_write.expected index ab5b6efc8..53c9b519b 100644 --- a/src/test/correct/secret_write/clang_pic/secret_write.expected +++ b/src/test/correct/secret_write/clang_pic/secret_write.expected @@ -1,57 +1,57 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69688bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69692bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern} {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -117,7 +117,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69566bv64) == 0bv8); free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -126,13 +126,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); @@ -284,7 +284,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4024bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4024bv64)) || L(mem, bvadd64(R9, 4024bv64))); diff --git a/src/test/correct/secret_write/gcc/secret_write.expected b/src/test/correct/secret_write/gcc/secret_write.expected index 79a5d1522..fbb8b7faf 100644 --- a/src/test/correct/secret_write/gcc/secret_write.expected +++ b/src/test/correct/secret_write/gcc/secret_write.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69660bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69656bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern} {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -90,13 +90,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); @@ -200,7 +200,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); diff --git a/src/test/correct/secret_write/gcc_O2/secret_write.expected b/src/test/correct/secret_write/gcc_O2/secret_write.expected index 2fc76ef05..393a51bf6 100644 --- a/src/test/correct/secret_write/gcc_O2/secret_write.expected +++ b/src/test/correct/secret_write/gcc_O2/secret_write.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_R3: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } R3: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_R3: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} R3: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69660bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern} {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -92,13 +92,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); @@ -202,7 +202,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R3, Gamma_R3 := 2bv64, true; diff --git a/src/test/correct/secret_write/gcc_no_plt_no_pic/secret_write.expected b/src/test/correct/secret_write/gcc_no_plt_no_pic/secret_write.expected index 5de4303c7..9d6a27f3f 100644 --- a/src/test/correct/secret_write/gcc_no_plt_no_pic/secret_write.expected +++ b/src/test/correct/secret_write/gcc_no_plt_no_pic/secret_write.expected @@ -1,45 +1,45 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69660bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69656bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern} {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -90,13 +90,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); @@ -200,7 +200,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); diff --git a/src/test/correct/secret_write/gcc_pic/secret_write.expected b/src/test/correct/secret_write/gcc_pic/secret_write.expected index 26aaecbce..2275cb362 100644 --- a/src/test/correct/secret_write/gcc_pic/secret_write.expected +++ b/src/test/correct/secret_write/gcc_pic/secret_write.expected @@ -1,53 +1,53 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69660bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69656bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $x_addr) then (bvsmod32(memory_load32_le(memory, $z_addr), 2bv32) == 0bv32) else (if (index == $z_addr) then true else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); -function {:extern } {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvsge"} bvsge32(bv32, bv32) returns (bool); +function {:extern} {:bvbuiltin "bvsmod"} bvsmod32(bv32, bv32) returns (bv32); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); @@ -113,7 +113,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $z_addr) == old(memory_load32_le(mem, $z_addr))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -122,13 +122,13 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr)); assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert bvsge32(memory_load32_le(mem, $z_addr), memory_load32_le(mem, $z_addr)); @@ -280,7 +280,7 @@ procedure main() var Gamma_x_old: bool; var z_old: bv32; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4048bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4048bv64)) || L(mem, bvadd64(R0, 4048bv64))); diff --git a/src/test/correct/simple_jump/clang/simple_jump.expected b/src/test/correct/simple_jump/clang/simple_jump.expected index a6d221d75..62a848c1f 100644 --- a/src/test/correct/simple_jump/clang/simple_jump.expected +++ b/src/test/correct/simple_jump/clang/simple_jump.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1892bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,7 +199,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000002f1"} true; @@ -219,28 +219,31 @@ procedure main() } goto l00000329; l00000329: + assume {:captureState "l00000329"} true; R8, Gamma_R8 := 1bv64, true; goto l0000032c; l00000326: + assume {:captureState "l00000326"} true; R8, Gamma_R8 := 0bv64, true; goto l0000032c; l0000032c: + assume {:captureState "l0000032c"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000334; } goto l0000034b; l0000034b: - assume {:captureState "addr:l0000034b"} true; + assume {:captureState "l0000034b"} true; goto l0000034c; l0000034c: - assume {:captureState "addr:l0000034c"} true; + assume {:captureState "l0000034c"} true; R8, Gamma_R8 := 6bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); assume {:captureState "%0000035a"} true; goto l00000334; l00000334: - assume {:captureState "addr:l00000334"} true; + assume {:captureState "l00000334"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/simple_jump/clang_O2/simple_jump.expected b/src/test/correct/simple_jump/clang_O2/simple_jump.expected index dfc8a4e7d..b904c03a5 100644 --- a/src/test/correct/simple_jump/clang_O2/simple_jump.expected +++ b/src/test/correct/simple_jump/clang_O2/simple_jump.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1840bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/simple_jump/clang_no_plt_no_pic/simple_jump.expected b/src/test/correct/simple_jump/clang_no_plt_no_pic/simple_jump.expected index 6fcd81902..0973d91cd 100644 --- a/src/test/correct/simple_jump/clang_no_plt_no_pic/simple_jump.expected +++ b/src/test/correct/simple_jump/clang_no_plt_no_pic/simple_jump.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1892bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,7 +199,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000903"} true; @@ -219,28 +219,31 @@ procedure main() } goto l0000093b; l0000093b: + assume {:captureState "l0000093b"} true; R8, Gamma_R8 := 1bv64, true; goto l0000093e; l00000938: + assume {:captureState "l00000938"} true; R8, Gamma_R8 := 0bv64, true; goto l0000093e; l0000093e: + assume {:captureState "l0000093e"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000946; } goto l0000095d; l0000095d: - assume {:captureState "addr:l0000095d"} true; + assume {:captureState "l0000095d"} true; goto l0000095e; l0000095e: - assume {:captureState "addr:l0000095e"} true; + assume {:captureState "l0000095e"} true; R8, Gamma_R8 := 6bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); assume {:captureState "%0000096c"} true; goto l00000946; l00000946: - assume {:captureState "addr:l00000946"} true; + assume {:captureState "l00000946"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/simple_jump/clang_pic/simple_jump.expected b/src/test/correct/simple_jump/clang_pic/simple_jump.expected index 6fcd81902..0973d91cd 100644 --- a/src/test/correct/simple_jump/clang_pic/simple_jump.expected +++ b/src/test/correct/simple_jump/clang_pic/simple_jump.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1892bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,7 +199,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000903"} true; @@ -219,28 +219,31 @@ procedure main() } goto l0000093b; l0000093b: + assume {:captureState "l0000093b"} true; R8, Gamma_R8 := 1bv64, true; goto l0000093e; l00000938: + assume {:captureState "l00000938"} true; R8, Gamma_R8 := 0bv64, true; goto l0000093e; l0000093e: + assume {:captureState "l0000093e"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000946; } goto l0000095d; l0000095d: - assume {:captureState "addr:l0000095d"} true; + assume {:captureState "l0000095d"} true; goto l0000095e; l0000095e: - assume {:captureState "addr:l0000095e"} true; + assume {:captureState "l0000095e"} true; R8, Gamma_R8 := 6bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); assume {:captureState "%0000096c"} true; goto l00000946; l00000946: - assume {:captureState "addr:l00000946"} true; + assume {:captureState "l00000946"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/simple_jump/gcc/simple_jump.expected b/src/test/correct/simple_jump/gcc/simple_jump.expected index f38dfebe9..9523ac12f 100644 --- a/src/test/correct/simple_jump/gcc/simple_jump.expected +++ b/src/test/correct/simple_jump/gcc/simple_jump.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1876bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -197,7 +197,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); @@ -214,13 +214,13 @@ procedure main() } goto l0000031f; l0000031f: - assume {:captureState "addr:l0000031f"} true; + assume {:captureState "l0000031f"} true; R0, Gamma_R0 := 6bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%0000032a"} true; goto l0000030a; l0000030a: - assume {:captureState "addr:l0000030a"} true; + assume {:captureState "l0000030a"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/simple_jump/gcc_O2/simple_jump.expected b/src/test/correct/simple_jump/gcc_O2/simple_jump.expected index db578d839..306991d20 100644 --- a/src/test/correct/simple_jump/gcc_O2/simple_jump.expected +++ b/src/test/correct/simple_jump/gcc_O2/simple_jump.expected @@ -1,14 +1,14 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1896bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -49,7 +49,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -58,9 +58,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -155,7 +155,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 0bv64, true; return; } diff --git a/src/test/correct/simple_jump/gcc_no_plt_no_pic/simple_jump.expected b/src/test/correct/simple_jump/gcc_no_plt_no_pic/simple_jump.expected index 4f0549236..76f57dcef 100644 --- a/src/test/correct/simple_jump/gcc_no_plt_no_pic/simple_jump.expected +++ b/src/test/correct/simple_jump/gcc_no_plt_no_pic/simple_jump.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1876bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -197,7 +197,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); @@ -214,13 +214,13 @@ procedure main() } goto l000008f6; l000008f6: - assume {:captureState "addr:l000008f6"} true; + assume {:captureState "l000008f6"} true; R0, Gamma_R0 := 6bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000901"} true; goto l000008e1; l000008e1: - assume {:captureState "addr:l000008e1"} true; + assume {:captureState "l000008e1"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/simple_jump/gcc_pic/simple_jump.expected b/src/test/correct/simple_jump/gcc_pic/simple_jump.expected index 4f0549236..76f57dcef 100644 --- a/src/test/correct/simple_jump/gcc_pic/simple_jump.expected +++ b/src/test/correct/simple_jump/gcc_pic/simple_jump.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1876bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -197,7 +197,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); @@ -214,13 +214,13 @@ procedure main() } goto l000008f6; l000008f6: - assume {:captureState "addr:l000008f6"} true; + assume {:captureState "l000008f6"} true; R0, Gamma_R0 := 6bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000901"} true; goto l000008e1; l000008e1: - assume {:captureState "addr:l000008e1"} true; + assume {:captureState "l000008e1"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/switch/clang/switch.expected b/src/test/correct/switch/clang/switch.expected index bb6a2c6e9..75db57ac2 100644 --- a/src/test/correct/switch/clang/switch.expected +++ b/src/test/correct/switch/clang/switch.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1936bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,7 +199,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); @@ -221,22 +221,25 @@ procedure main() } goto l0000035d; l0000035d: + assume {:captureState "l0000035d"} true; R8, Gamma_R8 := 1bv64, true; goto l00000360; l0000035a: + assume {:captureState "l0000035a"} true; R8, Gamma_R8 := 0bv64, true; goto l00000360; l00000360: + assume {:captureState "l00000360"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000368; } goto l0000039a; l0000039a: - assume {:captureState "addr:l0000039a"} true; + assume {:captureState "l0000039a"} true; goto l0000039b; l0000039b: - assume {:captureState "addr:l0000039b"} true; + assume {:captureState "l0000039b"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #5, Gamma_#5 := bvadd32(R8[32:0], 4294967292bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934589bv33))), (Gamma_R8 && Gamma_#5); @@ -250,40 +253,43 @@ procedure main() } goto l000003c7; l000003c7: + assume {:captureState "l000003c7"} true; R8, Gamma_R8 := 1bv64, true; goto l000003ca; l000003c4: + assume {:captureState "l000003c4"} true; R8, Gamma_R8 := 0bv64, true; goto l000003ca; l000003ca: + assume {:captureState "l000003ca"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000389; } goto l000003d7; l00000389: - assume {:captureState "addr:l00000389"} true; + assume {:captureState "l00000389"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); assume {:captureState "%00000394"} true; goto l0000037b; l000003d7: - assume {:captureState "addr:l000003d7"} true; + assume {:captureState "l000003d7"} true; goto l000003d8; l000003d8: - assume {:captureState "addr:l000003d8"} true; + assume {:captureState "l000003d8"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); assume {:captureState "%000003e6"} true; goto l00000368; l00000368: - assume {:captureState "addr:l00000368"} true; + assume {:captureState "l00000368"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); assume {:captureState "%00000378"} true; goto l0000037b; l0000037b: - assume {:captureState "addr:l0000037b"} true; + assume {:captureState "l0000037b"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/switch/clang_O2/switch.expected b/src/test/correct/switch/clang_O2/switch.expected index a691307d3..ae43ad872 100644 --- a/src/test/correct/switch/clang_O2/switch.expected +++ b/src/test/correct/switch/clang_O2/switch.expected @@ -1,12 +1,12 @@ -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} mem: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1836bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -47,7 +47,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,9 +56,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -152,6 +152,6 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; return; } diff --git a/src/test/correct/switch/clang_no_plt_no_pic/switch.expected b/src/test/correct/switch/clang_no_plt_no_pic/switch.expected index f42ab7744..e904c4952 100644 --- a/src/test/correct/switch/clang_no_plt_no_pic/switch.expected +++ b/src/test/correct/switch/clang_no_plt_no_pic/switch.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1936bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,7 +199,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); @@ -221,22 +221,25 @@ procedure main() } goto l00000a12; l00000a12: + assume {:captureState "l00000a12"} true; R8, Gamma_R8 := 1bv64, true; goto l00000a15; l00000a0f: + assume {:captureState "l00000a0f"} true; R8, Gamma_R8 := 0bv64, true; goto l00000a15; l00000a15: + assume {:captureState "l00000a15"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000a1d; } goto l00000a4f; l00000a4f: - assume {:captureState "addr:l00000a4f"} true; + assume {:captureState "l00000a4f"} true; goto l00000a50; l00000a50: - assume {:captureState "addr:l00000a50"} true; + assume {:captureState "l00000a50"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #5, Gamma_#5 := bvadd32(R8[32:0], 4294967292bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934589bv33))), (Gamma_R8 && Gamma_#5); @@ -250,40 +253,43 @@ procedure main() } goto l00000a7c; l00000a7c: + assume {:captureState "l00000a7c"} true; R8, Gamma_R8 := 1bv64, true; goto l00000a7f; l00000a79: + assume {:captureState "l00000a79"} true; R8, Gamma_R8 := 0bv64, true; goto l00000a7f; l00000a7f: + assume {:captureState "l00000a7f"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000a3e; } goto l00000a8c; l00000a3e: - assume {:captureState "addr:l00000a3e"} true; + assume {:captureState "l00000a3e"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); assume {:captureState "%00000a49"} true; goto l00000a30; l00000a8c: - assume {:captureState "addr:l00000a8c"} true; + assume {:captureState "l00000a8c"} true; goto l00000a8d; l00000a8d: - assume {:captureState "addr:l00000a8d"} true; + assume {:captureState "l00000a8d"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); assume {:captureState "%00000a9b"} true; goto l00000a1d; l00000a1d: - assume {:captureState "addr:l00000a1d"} true; + assume {:captureState "l00000a1d"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); assume {:captureState "%00000a2d"} true; goto l00000a30; l00000a30: - assume {:captureState "addr:l00000a30"} true; + assume {:captureState "l00000a30"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/switch/clang_pic/switch.expected b/src/test/correct/switch/clang_pic/switch.expected index f42ab7744..e904c4952 100644 --- a/src/test/correct/switch/clang_pic/switch.expected +++ b/src/test/correct/switch/clang_pic/switch.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1936bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,7 +199,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); @@ -221,22 +221,25 @@ procedure main() } goto l00000a12; l00000a12: + assume {:captureState "l00000a12"} true; R8, Gamma_R8 := 1bv64, true; goto l00000a15; l00000a0f: + assume {:captureState "l00000a0f"} true; R8, Gamma_R8 := 0bv64, true; goto l00000a15; l00000a15: + assume {:captureState "l00000a15"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000a1d; } goto l00000a4f; l00000a4f: - assume {:captureState "addr:l00000a4f"} true; + assume {:captureState "l00000a4f"} true; goto l00000a50; l00000a50: - assume {:captureState "addr:l00000a50"} true; + assume {:captureState "l00000a50"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #5, Gamma_#5 := bvadd32(R8[32:0], 4294967292bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934589bv33))), (Gamma_R8 && Gamma_#5); @@ -250,40 +253,43 @@ procedure main() } goto l00000a7c; l00000a7c: + assume {:captureState "l00000a7c"} true; R8, Gamma_R8 := 1bv64, true; goto l00000a7f; l00000a79: + assume {:captureState "l00000a79"} true; R8, Gamma_R8 := 0bv64, true; goto l00000a7f; l00000a7f: + assume {:captureState "l00000a7f"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000a3e; } goto l00000a8c; l00000a3e: - assume {:captureState "addr:l00000a3e"} true; + assume {:captureState "l00000a3e"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); assume {:captureState "%00000a49"} true; goto l00000a30; l00000a8c: - assume {:captureState "addr:l00000a8c"} true; + assume {:captureState "l00000a8c"} true; goto l00000a8d; l00000a8d: - assume {:captureState "addr:l00000a8d"} true; + assume {:captureState "l00000a8d"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); assume {:captureState "%00000a9b"} true; goto l00000a1d; l00000a1d: - assume {:captureState "addr:l00000a1d"} true; + assume {:captureState "l00000a1d"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R8); assume {:captureState "%00000a2d"} true; goto l00000a30; l00000a30: - assume {:captureState "addr:l00000a30"} true; + assume {:captureState "l00000a30"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/switch/gcc/switch.expected b/src/test/correct/switch/gcc/switch.expected index 1c1f4e5b3..de46b7181 100644 --- a/src/test/correct/switch/gcc/switch.expected +++ b/src/test/correct/switch/gcc/switch.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1916bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,7 +199,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); @@ -218,7 +218,7 @@ procedure main() } goto l0000036b; l0000036b: - assume {:captureState "addr:l0000036b"} true; + assume {:captureState "l0000036b"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#5); @@ -231,25 +231,25 @@ procedure main() } goto l00000391; l0000035c: - assume {:captureState "addr:l0000035c"} true; + assume {:captureState "l0000035c"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000367"} true; goto l0000034c; l00000391: - assume {:captureState "addr:l00000391"} true; + assume {:captureState "l00000391"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%0000039c"} true; goto l00000339; l00000339: - assume {:captureState "addr:l00000339"} true; + assume {:captureState "l00000339"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000349"} true; goto l0000034c; l0000034c: - assume {:captureState "addr:l0000034c"} true; + assume {:captureState "l0000034c"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/switch/gcc_O2/switch.expected b/src/test/correct/switch/gcc_O2/switch.expected index 9c7036705..f96261171 100644 --- a/src/test/correct/switch/gcc_O2/switch.expected +++ b/src/test/correct/switch/gcc_O2/switch.expected @@ -1,12 +1,12 @@ -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} mem: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1896bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -47,7 +47,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -56,9 +56,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -152,6 +152,6 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; return; } diff --git a/src/test/correct/switch/gcc_no_plt_no_pic/switch.expected b/src/test/correct/switch/gcc_no_plt_no_pic/switch.expected index c5cfde371..ef08dc502 100644 --- a/src/test/correct/switch/gcc_no_plt_no_pic/switch.expected +++ b/src/test/correct/switch/gcc_no_plt_no_pic/switch.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1916bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,7 +199,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); @@ -218,7 +218,7 @@ procedure main() } goto l000009ca; l000009ca: - assume {:captureState "addr:l000009ca"} true; + assume {:captureState "l000009ca"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#5); @@ -231,25 +231,25 @@ procedure main() } goto l000009f0; l000009bb: - assume {:captureState "addr:l000009bb"} true; + assume {:captureState "l000009bb"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000009c6"} true; goto l000009ab; l000009f0: - assume {:captureState "addr:l000009f0"} true; + assume {:captureState "l000009f0"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000009fb"} true; goto l00000998; l00000998: - assume {:captureState "addr:l00000998"} true; + assume {:captureState "l00000998"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000009a8"} true; goto l000009ab; l000009ab: - assume {:captureState "addr:l000009ab"} true; + assume {:captureState "l000009ab"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/switch/gcc_pic/switch.expected b/src/test/correct/switch/gcc_pic/switch.expected index c5cfde371..ef08dc502 100644 --- a/src/test/correct/switch/gcc_pic/switch.expected +++ b/src/test/correct/switch/gcc_pic/switch.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1916bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -199,7 +199,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 8bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 8bv64), Gamma_R0); @@ -218,7 +218,7 @@ procedure main() } goto l000009ca; l000009ca: - assume {:captureState "addr:l000009ca"} true; + assume {:captureState "l000009ca"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 8bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 8bv64)); #5, Gamma_#5 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#5, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#5); @@ -231,25 +231,25 @@ procedure main() } goto l000009f0; l000009bb: - assume {:captureState "addr:l000009bb"} true; + assume {:captureState "l000009bb"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000009c6"} true; goto l000009ab; l000009f0: - assume {:captureState "addr:l000009f0"} true; + assume {:captureState "l000009f0"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000009fb"} true; goto l00000998; l00000998: - assume {:captureState "addr:l00000998"} true; + assume {:captureState "l00000998"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000009a8"} true; goto l000009ab; l000009ab: - assume {:captureState "addr:l000009ab"} true; + assume {:captureState "l000009ab"} true; R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; } diff --git a/src/test/correct/switch2/clang_O2/switch2.expected b/src/test/correct/switch2/clang_O2/switch2.expected index 00ab15c63..9083f1e41 100644 --- a/src/test/correct/switch2/clang_O2/switch2.expected +++ b/src/test/correct/switch2/clang_O2/switch2.expected @@ -1,11 +1,11 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } mem: [bv64]bv8; -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} mem: [bv64]bv8; +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -46,7 +46,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -55,9 +55,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -152,6 +152,6 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; return; } diff --git a/src/test/correct/switch2/gcc/switch2.expected b/src/test/correct/switch2/gcc/switch2.expected index 979e96843..e577cd799 100644 --- a/src/test/correct/switch2/gcc/switch2.expected +++ b/src/test/correct/switch2/gcc/switch2.expected @@ -1,65 +1,65 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,7 +100,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,9 +109,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -237,7 +237,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000386"} true; @@ -263,13 +263,13 @@ procedure main() } goto l00000408; l000003d0: - assume {:captureState "addr:l000003d0"} true; + assume {:captureState "l000003d0"} true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%000003e0"} true; goto l000003e2; l00000408: - assume {:captureState "addr:l00000408"} true; + assume {:captureState "l00000408"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#6); @@ -282,7 +282,7 @@ procedure main() } goto l00000430; l00000430: - assume {:captureState "addr:l00000430"} true; + assume {:captureState "l00000430"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #7, Gamma_#7 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#7); @@ -295,7 +295,7 @@ procedure main() } goto l00000467; l00000467: - assume {:captureState "addr:l00000467"} true; + assume {:captureState "l00000467"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #8, Gamma_#8 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#8); @@ -308,7 +308,7 @@ procedure main() } goto l0000048f; l0000048f: - assume {:captureState "addr:l0000048f"} true; + assume {:captureState "l0000048f"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #9, Gamma_#9 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#9); @@ -321,17 +321,17 @@ procedure main() } goto l000004e2; l000004b0: - assume {:captureState "addr:l000004b0"} true; + assume {:captureState "l000004b0"} true; R30, Gamma_R30 := 1944bv64, true; call r(); goto l000004bc; l000004bc: - assume {:captureState "addr:l000004bc"} true; + assume {:captureState "l000004bc"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%000004c2"} true; goto l000004c4; l000004e2: - assume {:captureState "addr:l000004e2"} true; + assume {:captureState "l000004e2"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #10, Gamma_#10 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#10); @@ -344,7 +344,7 @@ procedure main() } goto l0000050a; l0000050a: - assume {:captureState "addr:l0000050a"} true; + assume {:captureState "l0000050a"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #11, Gamma_#11 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#11); @@ -357,13 +357,13 @@ procedure main() } goto l00000530; l000004c4: - assume {:captureState "addr:l000004c4"} true; + assume {:captureState "l000004c4"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%000004cf"} true; goto l000003f1; l00000530: - assume {:captureState "addr:l00000530"} true; + assume {:captureState "l00000530"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #12, Gamma_#12 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#12); @@ -376,28 +376,28 @@ procedure main() } goto l00000556; l000004d5: - assume {:captureState "addr:l000004d5"} true; + assume {:captureState "l000004d5"} true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%000004e0"} true; goto l00000451; l00000451: - assume {:captureState "addr:l00000451"} true; + assume {:captureState "l00000451"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%00000461"} true; goto l000003f1; l00000556: - assume {:captureState "addr:l00000556"} true; + assume {:captureState "l00000556"} true; goto l000003e2; l000003e2: - assume {:captureState "addr:l000003e2"} true; + assume {:captureState "l000003e2"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%000003ed"} true; goto l000003f1; l000003f1: - assume {:captureState "addr:l000003f1"} true; + assume {:captureState "l000003f1"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 48bv64), Gamma_R31; @@ -480,7 +480,7 @@ procedure r() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lr: - assume {:captureState "addr:lr"} true; + assume {:captureState "lr"} true; R0, Gamma_R0 := 1bv64, true; return; } diff --git a/src/test/correct/switch2/gcc_O2/switch2.expected b/src/test/correct/switch2/gcc_O2/switch2.expected index 3b9fce4b6..8dd64e5d7 100644 --- a/src/test/correct/switch2/gcc_O2/switch2.expected +++ b/src/test/correct/switch2/gcc_O2/switch2.expected @@ -1,11 +1,11 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } mem: [bv64]bv8; -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} mem: [bv64]bv8; +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -46,7 +46,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -55,9 +55,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -152,6 +152,6 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; return; } diff --git a/src/test/correct/switch2/gcc_no_plt_no_pic/switch2.expected b/src/test/correct/switch2/gcc_no_plt_no_pic/switch2.expected index f2edcd64a..d39a1164a 100644 --- a/src/test/correct/switch2/gcc_no_plt_no_pic/switch2.expected +++ b/src/test/correct/switch2/gcc_no_plt_no_pic/switch2.expected @@ -1,65 +1,65 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,7 +100,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,9 +109,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -237,7 +237,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000be5"} true; @@ -263,13 +263,13 @@ procedure main() } goto l00000c67; l00000c2f: - assume {:captureState "addr:l00000c2f"} true; + assume {:captureState "l00000c2f"} true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%00000c3f"} true; goto l00000c41; l00000c67: - assume {:captureState "addr:l00000c67"} true; + assume {:captureState "l00000c67"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#6); @@ -282,7 +282,7 @@ procedure main() } goto l00000c8f; l00000c8f: - assume {:captureState "addr:l00000c8f"} true; + assume {:captureState "l00000c8f"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #7, Gamma_#7 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#7); @@ -295,7 +295,7 @@ procedure main() } goto l00000cc6; l00000cc6: - assume {:captureState "addr:l00000cc6"} true; + assume {:captureState "l00000cc6"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #8, Gamma_#8 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#8); @@ -308,7 +308,7 @@ procedure main() } goto l00000cee; l00000cee: - assume {:captureState "addr:l00000cee"} true; + assume {:captureState "l00000cee"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #9, Gamma_#9 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#9); @@ -321,17 +321,17 @@ procedure main() } goto l00000d41; l00000d0f: - assume {:captureState "addr:l00000d0f"} true; + assume {:captureState "l00000d0f"} true; R30, Gamma_R30 := 1944bv64, true; call r(); goto l00000d1b; l00000d1b: - assume {:captureState "addr:l00000d1b"} true; + assume {:captureState "l00000d1b"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%00000d21"} true; goto l00000d23; l00000d41: - assume {:captureState "addr:l00000d41"} true; + assume {:captureState "l00000d41"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #10, Gamma_#10 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#10); @@ -344,7 +344,7 @@ procedure main() } goto l00000d69; l00000d69: - assume {:captureState "addr:l00000d69"} true; + assume {:captureState "l00000d69"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #11, Gamma_#11 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#11); @@ -357,13 +357,13 @@ procedure main() } goto l00000d8f; l00000d23: - assume {:captureState "addr:l00000d23"} true; + assume {:captureState "l00000d23"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%00000d2e"} true; goto l00000c50; l00000d8f: - assume {:captureState "addr:l00000d8f"} true; + assume {:captureState "l00000d8f"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #12, Gamma_#12 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#12); @@ -376,28 +376,28 @@ procedure main() } goto l00000db5; l00000d34: - assume {:captureState "addr:l00000d34"} true; + assume {:captureState "l00000d34"} true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%00000d3f"} true; goto l00000cb0; l00000cb0: - assume {:captureState "addr:l00000cb0"} true; + assume {:captureState "l00000cb0"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%00000cc0"} true; goto l00000c50; l00000db5: - assume {:captureState "addr:l00000db5"} true; + assume {:captureState "l00000db5"} true; goto l00000c41; l00000c41: - assume {:captureState "addr:l00000c41"} true; + assume {:captureState "l00000c41"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%00000c4c"} true; goto l00000c50; l00000c50: - assume {:captureState "addr:l00000c50"} true; + assume {:captureState "l00000c50"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 48bv64), Gamma_R31; @@ -480,7 +480,7 @@ procedure r() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lr: - assume {:captureState "addr:lr"} true; + assume {:captureState "lr"} true; R0, Gamma_R0 := 1bv64, true; return; } diff --git a/src/test/correct/switch2/gcc_pic/switch2.expected b/src/test/correct/switch2/gcc_pic/switch2.expected index f2edcd64a..d39a1164a 100644 --- a/src/test/correct/switch2/gcc_pic/switch2.expected +++ b/src/test/correct/switch2/gcc_pic/switch2.expected @@ -1,65 +1,65 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvand"} bvand1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -100,7 +100,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -109,9 +109,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -237,7 +237,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%00000be5"} true; @@ -263,13 +263,13 @@ procedure main() } goto l00000c67; l00000c2f: - assume {:captureState "addr:l00000c2f"} true; + assume {:captureState "l00000c2f"} true; R0, Gamma_R0 := 4bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%00000c3f"} true; goto l00000c41; l00000c67: - assume {:captureState "addr:l00000c67"} true; + assume {:captureState "l00000c67"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967290bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934587bv33))), (Gamma_R0 && Gamma_#6); @@ -282,7 +282,7 @@ procedure main() } goto l00000c8f; l00000c8f: - assume {:captureState "addr:l00000c8f"} true; + assume {:captureState "l00000c8f"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #7, Gamma_#7 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#7, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#7); @@ -295,7 +295,7 @@ procedure main() } goto l00000cc6; l00000cc6: - assume {:captureState "addr:l00000cc6"} true; + assume {:captureState "l00000cc6"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #8, Gamma_#8 := bvadd32(R0[32:0], 4294967291bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#8, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934588bv33))), (Gamma_R0 && Gamma_#8); @@ -308,7 +308,7 @@ procedure main() } goto l00000cee; l00000cee: - assume {:captureState "addr:l00000cee"} true; + assume {:captureState "l00000cee"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #9, Gamma_#9 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#9, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#9); @@ -321,17 +321,17 @@ procedure main() } goto l00000d41; l00000d0f: - assume {:captureState "addr:l00000d0f"} true; + assume {:captureState "l00000d0f"} true; R30, Gamma_R30 := 1944bv64, true; call r(); goto l00000d1b; l00000d1b: - assume {:captureState "addr:l00000d1b"} true; + assume {:captureState "l00000d1b"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%00000d21"} true; goto l00000d23; l00000d41: - assume {:captureState "addr:l00000d41"} true; + assume {:captureState "l00000d41"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #10, Gamma_#10 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#10, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#10); @@ -344,7 +344,7 @@ procedure main() } goto l00000d69; l00000d69: - assume {:captureState "addr:l00000d69"} true; + assume {:captureState "l00000d69"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #11, Gamma_#11 := bvadd32(R0[32:0], 4294967294bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#11, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934591bv33))), (Gamma_R0 && Gamma_#11); @@ -357,13 +357,13 @@ procedure main() } goto l00000d8f; l00000d23: - assume {:captureState "addr:l00000d23"} true; + assume {:captureState "l00000d23"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%00000d2e"} true; goto l00000c50; l00000d8f: - assume {:captureState "addr:l00000d8f"} true; + assume {:captureState "l00000d8f"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #12, Gamma_#12 := bvadd32(R0[32:0], 4294967293bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#12, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934590bv33))), (Gamma_R0 && Gamma_#12); @@ -376,28 +376,28 @@ procedure main() } goto l00000db5; l00000d34: - assume {:captureState "addr:l00000d34"} true; + assume {:captureState "l00000d34"} true; R0, Gamma_R0 := 2bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%00000d3f"} true; goto l00000cb0; l00000cb0: - assume {:captureState "addr:l00000cb0"} true; + assume {:captureState "l00000cb0"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%00000cc0"} true; goto l00000c50; l00000db5: - assume {:captureState "addr:l00000db5"} true; + assume {:captureState "l00000db5"} true; goto l00000c41; l00000c41: - assume {:captureState "addr:l00000c41"} true; + assume {:captureState "l00000c41"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%00000c4c"} true; goto l00000c50; l00000c50: - assume {:captureState "addr:l00000c50"} true; + assume {:captureState "l00000c50"} true; R29, Gamma_R29 := memory_load64_le(stack, R31), gamma_load64(Gamma_stack, R31); R30, Gamma_R30 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); R31, Gamma_R31 := bvadd64(R31, 48bv64), Gamma_R31; @@ -480,7 +480,7 @@ procedure r() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lr: - assume {:captureState "addr:lr"} true; + assume {:captureState "lr"} true; R0, Gamma_R0 := 1bv64, true; return; } diff --git a/src/test/correct/syscall/clang/syscall.expected b/src/test/correct/syscall/clang/syscall.expected index 63c701a70..5c23cb30f 100644 --- a/src/test/correct/syscall/clang/syscall.expected +++ b/src/test/correct/syscall/clang/syscall.expected @@ -1,62 +1,62 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1944bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,9 +106,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure fork(); @@ -286,7 +286,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -304,7 +304,7 @@ procedure main() call fork(); goto l00000317; l00000317: - assume {:captureState "addr:l00000317"} true; + assume {:captureState "l00000317"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%0000031d"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); diff --git a/src/test/correct/syscall/clang_no_plt_no_pic/syscall.expected b/src/test/correct/syscall/clang_no_plt_no_pic/syscall.expected index ec5e63070..d0efb46c8 100644 --- a/src/test/correct/syscall/clang_no_plt_no_pic/syscall.expected +++ b/src/test/correct/syscall/clang_no_plt_no_pic/syscall.expected @@ -1,62 +1,62 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1944bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,9 +106,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure fork(); @@ -286,7 +286,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -304,7 +304,7 @@ procedure main() call fork(); goto l0000092f; l0000092f: - assume {:captureState "addr:l0000092f"} true; + assume {:captureState "l0000092f"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000935"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); diff --git a/src/test/correct/syscall/clang_pic/syscall.expected b/src/test/correct/syscall/clang_pic/syscall.expected index ec5e63070..d0efb46c8 100644 --- a/src/test/correct/syscall/clang_pic/syscall.expected +++ b/src/test/correct/syscall/clang_pic/syscall.expected @@ -1,62 +1,62 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1944bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69686bv64) == 0bv8); free ensures (memory_load8_le(mem, 69687bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,9 +106,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure fork(); @@ -286,7 +286,7 @@ procedure main() var Gamma_#4: bool; var Gamma_#5: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; #4, Gamma_#4 := bvadd64(R31, 32bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); @@ -304,7 +304,7 @@ procedure main() call fork(); goto l0000092f; l0000092f: - assume {:captureState "addr:l0000092f"} true; + assume {:captureState "l0000092f"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000935"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); diff --git a/src/test/correct/syscall/gcc/syscall.expected b/src/test/correct/syscall/gcc/syscall.expected index 6e685e564..d10405962 100644 --- a/src/test/correct/syscall/gcc/syscall.expected +++ b/src/test/correct/syscall/gcc/syscall.expected @@ -1,62 +1,62 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1932bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,9 +106,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure fork(); @@ -284,7 +284,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%000002d8"} true; @@ -300,7 +300,7 @@ procedure main() call fork(); goto l00000302; l00000302: - assume {:captureState "addr:l00000302"} true; + assume {:captureState "l00000302"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%00000308"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 44bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 44bv64)); diff --git a/src/test/correct/syscall/gcc_O2/syscall.expected b/src/test/correct/syscall/gcc_O2/syscall.expected index 1147e7be6..757903692 100644 --- a/src/test/correct/syscall/gcc_O2/syscall.expected +++ b/src/test/correct/syscall/gcc_O2/syscall.expected @@ -1,16 +1,16 @@ -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1960bv64); -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -51,7 +51,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -60,9 +60,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure fork(); diff --git a/src/test/correct/syscall/gcc_no_plt_no_pic/syscall.expected b/src/test/correct/syscall/gcc_no_plt_no_pic/syscall.expected index 9a1a0f525..712177c54 100644 --- a/src/test/correct/syscall/gcc_no_plt_no_pic/syscall.expected +++ b/src/test/correct/syscall/gcc_no_plt_no_pic/syscall.expected @@ -1,62 +1,62 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1932bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,9 +106,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure fork(); @@ -284,7 +284,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%000008cf"} true; @@ -300,7 +300,7 @@ procedure main() call fork(); goto l000008f9; l000008f9: - assume {:captureState "addr:l000008f9"} true; + assume {:captureState "l000008f9"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%000008ff"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 44bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 44bv64)); diff --git a/src/test/correct/syscall/gcc_pic/syscall.expected b/src/test/correct/syscall/gcc_pic/syscall.expected index 9a1a0f525..712177c54 100644 --- a/src/test/correct/syscall/gcc_pic/syscall.expected +++ b/src/test/correct/syscall/gcc_pic/syscall.expected @@ -1,62 +1,62 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R16: bool; -var {:extern } Gamma_R17: bool; -var {:extern } Gamma_R29: bool; -var {:extern } Gamma_R30: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R16: bv64; -var {:extern } R17: bv64; -var {:extern } R29: bv64; -var {:extern } R30: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $_IO_stdin_used_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R16: bool; +var {:extern} Gamma_R17: bool; +var {:extern} Gamma_R29: bool; +var {:extern} Gamma_R30: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R16: bv64; +var {:extern} R17: bv64; +var {:extern} R29: bv64; +var {:extern} R30: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $_IO_stdin_used_addr: bv64; axiom ($_IO_stdin_used_addr == 1932bv64); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -97,7 +97,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -106,9 +106,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure fork(); @@ -284,7 +284,7 @@ procedure main() var #4: bv64; var Gamma_#4: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; #4, Gamma_#4 := bvadd64(R31, 18446744073709551568bv64), Gamma_R31; stack, Gamma_stack := memory_store64_le(stack, #4, R29), gamma_store64(Gamma_stack, #4, Gamma_R29); assume {:captureState "%000008cf"} true; @@ -300,7 +300,7 @@ procedure main() call fork(); goto l000008f9; l000008f9: - assume {:captureState "addr:l000008f9"} true; + assume {:captureState "l000008f9"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 44bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 44bv64), Gamma_R0); assume {:captureState "%000008ff"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 44bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 44bv64)); diff --git a/src/test/correct/using_gamma_conditional/clang/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/clang/using_gamma_conditional.expected index b28d5fecc..08d8da05a 100644 --- a/src/test/correct/using_gamma_conditional/clang/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/clang/using_gamma_conditional.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -95,12 +95,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); @@ -211,7 +211,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000002f5"} true; @@ -230,33 +230,36 @@ procedure main() } goto l00000325; l00000325: + assume {:captureState "l00000325"} true; R8, Gamma_R8 := 1bv64, true; goto l00000328; l00000322: + assume {:captureState "l00000322"} true; R8, Gamma_R8 := 0bv64, true; goto l00000328; l00000328: + assume {:captureState "l00000328"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000330; } goto l00000358; l00000330: - assume {:captureState "addr:l00000330"} true; + assume {:captureState "l00000330"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); assume {:captureState "%00000340"} true; goto l00000343; l00000358: - assume {:captureState "addr:l00000358"} true; + assume {:captureState "l00000358"} true; goto l00000359; l00000359: - assume {:captureState "addr:l00000359"} true; + assume {:captureState "l00000359"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000361"} true; goto l00000343; l00000343: - assume {:captureState "addr:l00000343"} true; + assume {:captureState "l00000343"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/using_gamma_conditional/clang_O2/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/clang_O2/using_gamma_conditional.expected index 70a7a92c3..60b84aa63 100644 --- a/src/test/correct/using_gamma_conditional/clang_O2/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/clang_O2/using_gamma_conditional.expected @@ -1,40 +1,40 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -75,7 +75,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -83,12 +83,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); @@ -197,7 +197,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -212,11 +212,14 @@ procedure main() } goto l000002e8; l000002e8: + assume {:captureState "l000002e8"} true; R0, Gamma_R0 := 1bv64, true; goto l000002eb; l000002e5: + assume {:captureState "l000002e5"} true; R0, Gamma_R0 := 0bv64, true; goto l000002eb; l000002eb: + assume {:captureState "l000002eb"} true; return; } diff --git a/src/test/correct/using_gamma_conditional/clang_no_plt_no_pic/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/clang_no_plt_no_pic/using_gamma_conditional.expected index 5bd1f8366..1dd67fe4c 100644 --- a/src/test/correct/using_gamma_conditional/clang_no_plt_no_pic/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/clang_no_plt_no_pic/using_gamma_conditional.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -87,7 +87,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -95,12 +95,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); @@ -211,7 +211,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000910"} true; @@ -230,33 +230,36 @@ procedure main() } goto l00000940; l00000940: + assume {:captureState "l00000940"} true; R8, Gamma_R8 := 1bv64, true; goto l00000943; l0000093d: + assume {:captureState "l0000093d"} true; R8, Gamma_R8 := 0bv64, true; goto l00000943; l00000943: + assume {:captureState "l00000943"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l0000094b; } goto l00000973; l0000094b: - assume {:captureState "addr:l0000094b"} true; + assume {:captureState "l0000094b"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); assume {:captureState "%0000095b"} true; goto l0000095e; l00000973: - assume {:captureState "addr:l00000973"} true; + assume {:captureState "l00000973"} true; goto l00000974; l00000974: - assume {:captureState "addr:l00000974"} true; + assume {:captureState "l00000974"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%0000097c"} true; goto l0000095e; l0000095e: - assume {:captureState "addr:l0000095e"} true; + assume {:captureState "l0000095e"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/using_gamma_conditional/clang_pic/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/clang_pic/using_gamma_conditional.expected index 02566c5be..72ef22ce4 100644 --- a/src/test/correct/using_gamma_conditional/clang_pic/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/clang_pic/using_gamma_conditional.expected @@ -1,60 +1,60 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69684bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -103,7 +103,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -111,12 +111,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); @@ -243,7 +243,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000002f9"} true; @@ -264,33 +264,36 @@ procedure main() } goto l00000330; l00000330: + assume {:captureState "l00000330"} true; R8, Gamma_R8 := 1bv64, true; goto l00000333; l0000032d: + assume {:captureState "l0000032d"} true; R8, Gamma_R8 := 0bv64, true; goto l00000333; l00000333: + assume {:captureState "l00000333"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l0000033b; } goto l00000363; l0000033b: - assume {:captureState "addr:l0000033b"} true; + assume {:captureState "l0000033b"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R8); assume {:captureState "%0000034b"} true; goto l0000034e; l00000363: - assume {:captureState "addr:l00000363"} true; + assume {:captureState "l00000363"} true; goto l00000364; l00000364: - assume {:captureState "addr:l00000364"} true; + assume {:captureState "l00000364"} true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%0000036c"} true; goto l0000034e; l0000034e: - assume {:captureState "addr:l0000034e"} true; + assume {:captureState "l0000034e"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/correct/using_gamma_conditional/gcc/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/gcc/using_gamma_conditional.expected index 9c3a5aa73..4ec9b160b 100644 --- a/src/test/correct/using_gamma_conditional/gcc/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/gcc/using_gamma_conditional.expected @@ -1,38 +1,38 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -73,7 +73,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -81,12 +81,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); @@ -195,7 +195,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -211,14 +211,14 @@ procedure main() } goto l00000309; l000002fa: - assume {:captureState "addr:l000002fa"} true; + assume {:captureState "l000002fa"} true; R0, Gamma_R0 := 1bv64, true; goto l00000304; l00000309: - assume {:captureState "addr:l00000309"} true; + assume {:captureState "l00000309"} true; R0, Gamma_R0 := 0bv64, true; goto l00000304; l00000304: - assume {:captureState "addr:l00000304"} true; + assume {:captureState "l00000304"} true; return; } diff --git a/src/test/correct/using_gamma_conditional/gcc_O2/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/gcc_O2/using_gamma_conditional.expected index b9ad0a983..10df26406 100644 --- a/src/test/correct/using_gamma_conditional/gcc_O2/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/gcc_O2/using_gamma_conditional.expected @@ -1,38 +1,38 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -73,7 +73,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -81,12 +81,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); @@ -195,7 +195,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; call rely(); R0, Gamma_R0 := zero_extend32_32(memory_load32_le(mem, bvadd64(R0, 20bv64))), (gamma_load32(Gamma_mem, bvadd64(R0, 20bv64)) || L(mem, bvadd64(R0, 20bv64))); @@ -210,11 +210,14 @@ procedure main() } goto l000001d2; l000001d2: + assume {:captureState "l000001d2"} true; R0, Gamma_R0 := 1bv64, true; goto l000001d5; l000001cf: + assume {:captureState "l000001cf"} true; R0, Gamma_R0 := 0bv64, true; goto l000001d5; l000001d5: + assume {:captureState "l000001d5"} true; return; } diff --git a/src/test/correct/using_gamma_conditional/gcc_no_plt_no_pic/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/gcc_no_plt_no_pic/using_gamma_conditional.expected index 7eff00ef6..44703edf4 100644 --- a/src/test/correct/using_gamma_conditional/gcc_no_plt_no_pic/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/gcc_no_plt_no_pic/using_gamma_conditional.expected @@ -1,38 +1,38 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -73,7 +73,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -81,12 +81,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); @@ -195,7 +195,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -211,14 +211,14 @@ procedure main() } goto l000008c2; l000008b3: - assume {:captureState "addr:l000008b3"} true; + assume {:captureState "l000008b3"} true; R0, Gamma_R0 := 1bv64, true; goto l000008bd; l000008c2: - assume {:captureState "addr:l000008c2"} true; + assume {:captureState "l000008c2"} true; R0, Gamma_R0 := 0bv64, true; goto l000008bd; l000008bd: - assume {:captureState "addr:l000008bd"} true; + assume {:captureState "l000008bd"} true; return; } diff --git a/src/test/correct/using_gamma_conditional/gcc_pic/using_gamma_conditional.expected b/src/test/correct/using_gamma_conditional/gcc_pic/using_gamma_conditional.expected index c801ee5ba..04f503f58 100644 --- a/src/test/correct/using_gamma_conditional/gcc_pic/using_gamma_conditional.expected +++ b/src/test/correct/using_gamma_conditional/gcc_pic/using_gamma_conditional.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -89,7 +89,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (old(gamma_load32(Gamma_mem, $x_addr)) ==> gamma_load32(Gamma_mem, $x_addr)); { @@ -97,12 +97,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); @@ -227,7 +227,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -244,14 +244,14 @@ procedure main() } goto l0000030a; l000002fb: - assume {:captureState "addr:l000002fb"} true; + assume {:captureState "l000002fb"} true; R0, Gamma_R0 := 1bv64, true; goto l00000305; l0000030a: - assume {:captureState "addr:l0000030a"} true; + assume {:captureState "l0000030a"} true; R0, Gamma_R0 := 0bv64, true; goto l00000305; l00000305: - assume {:captureState "addr:l00000305"} true; + assume {:captureState "l00000305"} true; return; } diff --git a/src/test/correct/using_gamma_write_z/clang/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/clang/using_gamma_write_z.expected index d5c6f60ac..5ab807fea 100644 --- a/src/test/correct/using_gamma_write_z/clang/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/clang/using_gamma_write_z.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -84,12 +84,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -189,7 +189,7 @@ procedure main() { var Gamma_x_old: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); diff --git a/src/test/correct/using_gamma_write_z/clang_O2/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/clang_O2/using_gamma_write_z.expected index 94dfe0e17..ba7a07752 100644 --- a/src/test/correct/using_gamma_write_z/clang_O2/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/clang_O2/using_gamma_write_z.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -84,12 +84,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -189,7 +189,7 @@ procedure main() { var Gamma_x_old: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 1bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/using_gamma_write_z/clang_no_plt_no_pic/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/clang_no_plt_no_pic/using_gamma_write_z.expected index 5e1b2c563..121f49afb 100644 --- a/src/test/correct/using_gamma_write_z/clang_no_plt_no_pic/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/clang_no_plt_no_pic/using_gamma_write_z.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -84,12 +84,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -189,7 +189,7 @@ procedure main() { var Gamma_x_old: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 69632bv64, true; R8, Gamma_R8 := 1bv64, true; call rely(); diff --git a/src/test/correct/using_gamma_write_z/clang_pic/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/clang_pic/using_gamma_write_z.expected index 14214bad0..c05386840 100644 --- a/src/test/correct/using_gamma_write_z/clang_pic/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/clang_pic/using_gamma_write_z.expected @@ -1,49 +1,49 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69684bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -92,7 +92,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69598bv64) == 0bv8); free ensures (memory_load8_le(mem, 69599bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -100,12 +100,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -221,7 +221,7 @@ procedure main() { var Gamma_x_old: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R9, Gamma_R9 := 65536bv64, true; call rely(); R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4040bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4040bv64)) || L(mem, bvadd64(R9, 4040bv64))); diff --git a/src/test/correct/using_gamma_write_z/gcc/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/gcc/using_gamma_write_z.expected index e7b37f433..195161608 100644 --- a/src/test/correct/using_gamma_write_z/gcc/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/gcc/using_gamma_write_z.expected @@ -1,39 +1,39 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -74,7 +74,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -82,12 +82,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -187,7 +187,7 @@ procedure main() { var Gamma_x_old: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; diff --git a/src/test/correct/using_gamma_write_z/gcc_O2/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/gcc_O2/using_gamma_write_z.expected index dd1f6d89b..6e3d75bef 100644 --- a/src/test/correct/using_gamma_write_z/gcc_O2/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/gcc_O2/using_gamma_write_z.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69656bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -84,12 +84,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -189,7 +189,7 @@ procedure main() { var Gamma_x_old: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := 1bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/correct/using_gamma_write_z/gcc_no_plt_no_pic/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/gcc_no_plt_no_pic/using_gamma_write_z.expected index 730fa2be4..8bf981db5 100644 --- a/src/test/correct/using_gamma_write_z/gcc_no_plt_no_pic/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/gcc_no_plt_no_pic/using_gamma_write_z.expected @@ -1,39 +1,39 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -74,7 +74,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -82,12 +82,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -187,7 +187,7 @@ procedure main() { var Gamma_x_old: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; R1, Gamma_R1 := 1bv64, true; diff --git a/src/test/correct/using_gamma_write_z/gcc_pic/using_gamma_write_z.expected b/src/test/correct/using_gamma_write_z/gcc_pic/using_gamma_write_z.expected index 24b2a2181..3ffffbcfb 100644 --- a/src/test/correct/using_gamma_write_z/gcc_pic/using_gamma_write_z.expected +++ b/src/test/correct/using_gamma_write_z/gcc_pic/using_gamma_write_z.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $x_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $x_addr) then (memory_load32_le(memory, $z_addr) == 0bv32) else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); @@ -90,7 +90,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69014bv64) == 0bv8); free ensures (memory_load8_le(mem, 69015bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures ((old(memory_load32_le(mem, $x_addr)) == memory_load32_le(mem, $x_addr)) && (old(memory_load32_le(mem, $z_addr)) == memory_load32_le(mem, $z_addr))); { @@ -98,12 +98,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert ((memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)) && (memory_load32_le(mem, $z_addr) == memory_load32_le(mem, $z_addr))); } -procedure {:extern } guarantee_reflexive() +procedure {:extern} guarantee_reflexive() modifies Gamma_mem, mem; { assert (gamma_load32(Gamma_mem, $x_addr) ==> gamma_load32(Gamma_mem, $x_addr)); @@ -219,7 +219,7 @@ procedure main() { var Gamma_x_old: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); diff --git a/src/test/incorrect/basicassign/clang/basicassign.expected b/src/test/incorrect/basicassign/clang/basicassign.expected index dcd284749..122d69a08 100644 --- a/src/test/incorrect/basicassign/clang/basicassign.expected +++ b/src/test/incorrect/basicassign/clang/basicassign.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R11: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R11: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R11: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R11: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69684bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69692bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -91,12 +91,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -191,7 +191,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R10, Gamma_R10 := 69632bv64, true; call rely(); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(mem, bvadd64(R10, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R10, 52bv64)) || L(mem, bvadd64(R10, 52bv64))); diff --git a/src/test/incorrect/basicassign/clang_O2/basicassign.expected b/src/test/incorrect/basicassign/clang_O2/basicassign.expected index c75852079..e3a318276 100644 --- a/src/test/incorrect/basicassign/clang_O2/basicassign.expected +++ b/src/test/incorrect/basicassign/clang_O2/basicassign.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69684bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69692bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -89,12 +89,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -189,7 +189,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; R9, Gamma_R9 := 69632bv64, true; diff --git a/src/test/incorrect/basicassign/clang_no_plt_no_pic/basicassign.expected b/src/test/incorrect/basicassign/clang_no_plt_no_pic/basicassign.expected index 96a69ffd6..3250d4cce 100644 --- a/src/test/incorrect/basicassign/clang_no_plt_no_pic/basicassign.expected +++ b/src/test/incorrect/basicassign/clang_no_plt_no_pic/basicassign.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R11: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R11: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R11: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R11: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69684bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69692bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -91,12 +91,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -191,7 +191,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R10, Gamma_R10 := 69632bv64, true; call rely(); R9, Gamma_R9 := zero_extend32_32(memory_load32_le(mem, bvadd64(R10, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R10, 52bv64)) || L(mem, bvadd64(R10, 52bv64))); diff --git a/src/test/incorrect/basicassign/clang_pic/basicassign.expected b/src/test/incorrect/basicassign/clang_pic/basicassign.expected index 90596d82e..ac86f966b 100644 --- a/src/test/incorrect/basicassign/clang_pic/basicassign.expected +++ b/src/test/incorrect/basicassign/clang_pic/basicassign.expected @@ -1,56 +1,56 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R11: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R11: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R11: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R11: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69684bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69692bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -115,7 +115,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69566bv64) == 0bv8); free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -123,12 +123,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -271,7 +271,7 @@ procedure main() free ensures (memory_load8_le(mem, 69567bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); diff --git a/src/test/incorrect/basicassign/gcc/basicassign.expected b/src/test/incorrect/basicassign/gcc/basicassign.expected index ac29f808a..121167794 100644 --- a/src/test/incorrect/basicassign/gcc/basicassign.expected +++ b/src/test/incorrect/basicassign/gcc/basicassign.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69660bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -85,12 +85,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -185,7 +185,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 28bv64), Gamma_R0; call rely(); diff --git a/src/test/incorrect/basicassign/gcc_O2/basicassign.expected b/src/test/incorrect/basicassign/gcc_O2/basicassign.expected index 040eea589..42773c210 100644 --- a/src/test/incorrect/basicassign/gcc_O2/basicassign.expected +++ b/src/test/incorrect/basicassign/gcc_O2/basicassign.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69652bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69656bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69660bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -87,12 +87,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -189,7 +189,7 @@ procedure main() var #1: bv64; var Gamma_#1: bool; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R2, Gamma_R2 := 69632bv64, true; R1, Gamma_R1 := bvadd64(R2, 20bv64), Gamma_R2; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/incorrect/basicassign/gcc_no_plt_no_pic/basicassign.expected b/src/test/incorrect/basicassign/gcc_no_plt_no_pic/basicassign.expected index 2889ce48f..499b391fd 100644 --- a/src/test/incorrect/basicassign/gcc_no_plt_no_pic/basicassign.expected +++ b/src/test/incorrect/basicassign/gcc_no_plt_no_pic/basicassign.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69660bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -85,12 +85,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -185,7 +185,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 28bv64), Gamma_R0; call rely(); diff --git a/src/test/incorrect/basicassign/gcc_pic/basicassign.expected b/src/test/incorrect/basicassign/gcc_pic/basicassign.expected index b79b6e403..e67a10bdf 100644 --- a/src/test/incorrect/basicassign/gcc_pic/basicassign.expected +++ b/src/test/incorrect/basicassign/gcc_pic/basicassign.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69660bv64); -const {:extern } $x_addr: bv64; +const {:extern} $x_addr: bv64; axiom ($x_addr == 69652bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else (if (index == $x_addr) then false else false))) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i]))))); ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); @@ -109,7 +109,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 68998bv64) == 0bv8); free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (memory_load32_le(mem, $x_addr) == old(memory_load32_le(mem, $x_addr))); { @@ -117,12 +117,12 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive() +procedure {:extern} rely_reflexive() { assert (memory_load32_le(mem, $x_addr) == memory_load32_le(mem, $x_addr)); } -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -265,7 +265,7 @@ procedure main() free ensures (memory_load8_le(mem, 68999bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4072bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4072bv64)) || L(mem, bvadd64(R0, 4072bv64))); diff --git a/src/test/incorrect/basicassign1/clang/basicassign1.expected b/src/test/incorrect/basicassign1/clang/basicassign1.expected index 697bdc1da..bd0fa29fe 100644 --- a/src/test/incorrect/basicassign1/clang/basicassign1.expected +++ b/src/test/incorrect/basicassign1/clang/basicassign1.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $z_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -189,7 +189,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 69632bv64, true; call rely(); diff --git a/src/test/incorrect/basicassign1/clang_O2/basicassign1.expected b/src/test/incorrect/basicassign1/clang_O2/basicassign1.expected index 4283ebc9c..54cfefaed 100644 --- a/src/test/incorrect/basicassign1/clang_O2/basicassign1.expected +++ b/src/test/incorrect/basicassign1/clang_O2/basicassign1.expected @@ -1,40 +1,40 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $z_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,9 +84,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -181,7 +181,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/incorrect/basicassign1/clang_no_plt_no_pic/basicassign1.expected b/src/test/incorrect/basicassign1/clang_no_plt_no_pic/basicassign1.expected index 33b46e8d3..05e7e5e2f 100644 --- a/src/test/incorrect/basicassign1/clang_no_plt_no_pic/basicassign1.expected +++ b/src/test/incorrect/basicassign1/clang_no_plt_no_pic/basicassign1.expected @@ -1,46 +1,46 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $z_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -81,7 +81,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -90,9 +90,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -189,7 +189,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 69632bv64, true; call rely(); diff --git a/src/test/incorrect/basicassign1/clang_pic/basicassign1.expected b/src/test/incorrect/basicassign1/clang_pic/basicassign1.expected index 89f18d503..dc205cce6 100644 --- a/src/test/incorrect/basicassign1/clang_pic/basicassign1.expected +++ b/src/test/incorrect/basicassign1/clang_pic/basicassign1.expected @@ -1,54 +1,54 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $z_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -105,7 +105,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -114,9 +114,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -245,7 +245,7 @@ procedure main() free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 65536bv64, true; call rely(); diff --git a/src/test/incorrect/basicassign1/gcc/basicassign1.expected b/src/test/incorrect/basicassign1/gcc/basicassign1.expected index f1b03dc62..ea9681d89 100644 --- a/src/test/incorrect/basicassign1/gcc/basicassign1.expected +++ b/src/test/incorrect/basicassign1/gcc/basicassign1.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $z_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,9 +86,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -185,7 +185,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; diff --git a/src/test/incorrect/basicassign1/gcc_O2/basicassign1.expected b/src/test/incorrect/basicassign1/gcc_O2/basicassign1.expected index c6e1dfbe6..0414017cb 100644 --- a/src/test/incorrect/basicassign1/gcc_O2/basicassign1.expected +++ b/src/test/incorrect/basicassign1/gcc_O2/basicassign1.expected @@ -1,40 +1,40 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $z_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,9 +84,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -181,7 +181,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 20bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/incorrect/basicassign1/gcc_no_plt_no_pic/basicassign1.expected b/src/test/incorrect/basicassign1/gcc_no_plt_no_pic/basicassign1.expected index af62fee01..fdcbd7147 100644 --- a/src/test/incorrect/basicassign1/gcc_no_plt_no_pic/basicassign1.expected +++ b/src/test/incorrect/basicassign1/gcc_no_plt_no_pic/basicassign1.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $z_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,9 +86,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -185,7 +185,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; diff --git a/src/test/incorrect/basicassign1/gcc_pic/basicassign1.expected b/src/test/incorrect/basicassign1/gcc_pic/basicassign1.expected index 42e0ac655..91a64b3f4 100644 --- a/src/test/incorrect/basicassign1/gcc_pic/basicassign1.expected +++ b/src/test/incorrect/basicassign1/gcc_pic/basicassign1.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $z_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69652bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else false) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -101,7 +101,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -110,9 +110,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -241,7 +241,7 @@ procedure main() free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 65536bv64, true; call rely(); diff --git a/src/test/incorrect/basicassign2/clang/basicassign2.expected b/src/test/incorrect/basicassign2/clang/basicassign2.expected index b2abd3337..471ecc76c 100644 --- a/src/test/incorrect/basicassign2/clang/basicassign2.expected +++ b/src/test/incorrect/basicassign2/clang/basicassign2.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69696bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,7 +82,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,9 +91,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -190,7 +190,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 69632bv64, true; call rely(); diff --git a/src/test/incorrect/basicassign2/clang_O2/basicassign2.expected b/src/test/incorrect/basicassign2/clang_O2/basicassign2.expected index 0a90e7afd..1443e9789 100644 --- a/src/test/incorrect/basicassign2/clang_O2/basicassign2.expected +++ b/src/test/incorrect/basicassign2/clang_O2/basicassign2.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69696bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,9 +85,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/incorrect/basicassign2/clang_no_plt_no_pic/basicassign2.expected b/src/test/incorrect/basicassign2/clang_no_plt_no_pic/basicassign2.expected index cc84f3c7c..911ce67bd 100644 --- a/src/test/incorrect/basicassign2/clang_no_plt_no_pic/basicassign2.expected +++ b/src/test/incorrect/basicassign2/clang_no_plt_no_pic/basicassign2.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69696bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,7 +82,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -91,9 +91,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -190,7 +190,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 69632bv64, true; call rely(); diff --git a/src/test/incorrect/basicassign2/clang_pic/basicassign2.expected b/src/test/incorrect/basicassign2/clang_pic/basicassign2.expected index a0c12c266..bb901dc08 100644 --- a/src/test/incorrect/basicassign2/clang_pic/basicassign2.expected +++ b/src/test/incorrect/basicassign2/clang_pic/basicassign2.expected @@ -1,47 +1,47 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69688bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69696bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -98,7 +98,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -107,9 +107,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -238,7 +238,7 @@ procedure main() free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 65536bv64, true; call rely(); diff --git a/src/test/incorrect/basicassign2/gcc/basicassign2.expected b/src/test/incorrect/basicassign2/gcc/basicassign2.expected index 9fec06590..95f92fbdc 100644 --- a/src/test/incorrect/basicassign2/gcc/basicassign2.expected +++ b/src/test/incorrect/basicassign2/gcc/basicassign2.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69664bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -78,7 +78,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,9 +87,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -186,7 +186,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 32bv64), Gamma_R0; diff --git a/src/test/incorrect/basicassign2/gcc_O2/basicassign2.expected b/src/test/incorrect/basicassign2/gcc_O2/basicassign2.expected index 3176d2791..2116e0774 100644 --- a/src/test/incorrect/basicassign2/gcc_O2/basicassign2.expected +++ b/src/test/incorrect/basicassign2/gcc_O2/basicassign2.expected @@ -1,41 +1,41 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69664bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -76,7 +76,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,9 +85,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -182,7 +182,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 24bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/incorrect/basicassign2/gcc_no_plt_no_pic/basicassign2.expected b/src/test/incorrect/basicassign2/gcc_no_plt_no_pic/basicassign2.expected index 04e29dfc2..190af2f08 100644 --- a/src/test/incorrect/basicassign2/gcc_no_plt_no_pic/basicassign2.expected +++ b/src/test/incorrect/basicassign2/gcc_no_plt_no_pic/basicassign2.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69664bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -78,7 +78,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -87,9 +87,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -186,7 +186,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 32bv64), Gamma_R0; diff --git a/src/test/incorrect/basicassign2/gcc_pic/basicassign2.expected b/src/test/incorrect/basicassign2/gcc_pic/basicassign2.expected index 202ea176e..1c35793fc 100644 --- a/src/test/incorrect/basicassign2/gcc_pic/basicassign2.expected +++ b/src/test/incorrect/basicassign2/gcc_pic/basicassign2.expected @@ -1,43 +1,43 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69664bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69656bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $z_addr) then true else (if (index == $secret_addr) then false else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -procedure {:extern } rely(); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,7 +94,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,9 +103,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -234,7 +234,7 @@ procedure main() free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 65536bv64, true; call rely(); diff --git a/src/test/incorrect/basicassign3/clang/basicassign3.expected b/src/test/incorrect/basicassign3/clang/basicassign3.expected index 49df57e92..75800d54a 100644 --- a/src/test/incorrect/basicassign3/clang/basicassign3.expected +++ b/src/test/incorrect/basicassign3/clang/basicassign3.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69681bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69682bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -187,7 +187,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 69632bv64, true; call rely(); diff --git a/src/test/incorrect/basicassign3/clang_O2/basicassign3.expected b/src/test/incorrect/basicassign3/clang_O2/basicassign3.expected index b6396a8e4..96cc417da 100644 --- a/src/test/incorrect/basicassign3/clang_O2/basicassign3.expected +++ b/src/test/incorrect/basicassign3/clang_O2/basicassign3.expected @@ -1,38 +1,38 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69684bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69688bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,9 +82,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -179,7 +179,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R8, Gamma_R8 := 69632bv64, true; R9, Gamma_R9 := 69632bv64, true; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/incorrect/basicassign3/clang_no_plt_no_pic/basicassign3.expected b/src/test/incorrect/basicassign3/clang_no_plt_no_pic/basicassign3.expected index bdad9f7d2..75b959513 100644 --- a/src/test/incorrect/basicassign3/clang_no_plt_no_pic/basicassign3.expected +++ b/src/test/incorrect/basicassign3/clang_no_plt_no_pic/basicassign3.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69681bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69682bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -187,7 +187,7 @@ procedure main() free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 69632bv64, true; call rely(); diff --git a/src/test/incorrect/basicassign3/clang_pic/basicassign3.expected b/src/test/incorrect/basicassign3/clang_pic/basicassign3.expected index ee84c2efe..7a4df88f4 100644 --- a/src/test/incorrect/basicassign3/clang_pic/basicassign3.expected +++ b/src/test/incorrect/basicassign3/clang_pic/basicassign3.expected @@ -1,52 +1,52 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R10: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R10: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R10: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R10: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69681bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69682bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -103,7 +103,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -112,9 +112,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -243,7 +243,7 @@ procedure main() free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R8, Gamma_R8 := 65536bv64, true; call rely(); diff --git a/src/test/incorrect/basicassign3/gcc/basicassign3.expected b/src/test/incorrect/basicassign3/gcc/basicassign3.expected index fdda84a60..a3c547bb3 100644 --- a/src/test/incorrect/basicassign3/gcc/basicassign3.expected +++ b/src/test/incorrect/basicassign3/gcc/basicassign3.expected @@ -1,40 +1,40 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69650bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69649bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,9 +84,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -183,7 +183,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 18bv64), Gamma_R0; diff --git a/src/test/incorrect/basicassign3/gcc_O2/basicassign3.expected b/src/test/incorrect/basicassign3/gcc_O2/basicassign3.expected index 9dff05b8e..62c8377ad 100644 --- a/src/test/incorrect/basicassign3/gcc_O2/basicassign3.expected +++ b/src/test/incorrect/basicassign3/gcc_O2/basicassign3.expected @@ -1,38 +1,38 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R2: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R2: bv64; -var {:extern } mem: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R2: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R2: bv64; +var {:extern} mem: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69650bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69649bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -73,7 +73,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -82,9 +82,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -179,7 +179,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R1, Gamma_R1 := 69632bv64, true; R2, Gamma_R2 := bvadd64(R1, 17bv64), Gamma_R1; R0, Gamma_R0 := 0bv64, true; diff --git a/src/test/incorrect/basicassign3/gcc_no_plt_no_pic/basicassign3.expected b/src/test/incorrect/basicassign3/gcc_no_plt_no_pic/basicassign3.expected index acd543640..ea6ea1a7b 100644 --- a/src/test/incorrect/basicassign3/gcc_no_plt_no_pic/basicassign3.expected +++ b/src/test/incorrect/basicassign3/gcc_no_plt_no_pic/basicassign3.expected @@ -1,40 +1,40 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69650bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69649bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -75,7 +75,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -84,9 +84,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -183,7 +183,7 @@ procedure main() free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 18bv64), Gamma_R0; diff --git a/src/test/incorrect/basicassign3/gcc_pic/basicassign3.expected b/src/test/incorrect/basicassign3/gcc_pic/basicassign3.expected index bdda92967..7e6204c20 100644 --- a/src/test/incorrect/basicassign3/gcc_pic/basicassign3.expected +++ b/src/test/incorrect/basicassign3/gcc_pic/basicassign3.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -const {:extern } $secret_addr: bv64; +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +const {:extern} $secret_addr: bv64; axiom ($secret_addr == 69650bv64); -const {:extern } $z_addr: bv64; +const {:extern} $z_addr: bv64; axiom ($z_addr == 69649bv64); -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { (if (index == $secret_addr) then false else (if (index == $z_addr) then true else false)) } -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load8(gammaMap: [bv64]bool, index: bv64) returns (bool) { gammaMap[index] } -function {:extern } gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store8(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value] } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { +function {:extern} memory_store8_le(memory: [bv64]bv8, index: bv64, value: bv8) returns ([bv64]bv8) { memory[index := value[8:0]] } -function {:extern } {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "zero_extend 56"} zero_extend56_8(bv8) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -99,7 +99,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -108,9 +108,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -239,7 +239,7 @@ procedure main() free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); { lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; R0, Gamma_R0 := 65536bv64, true; call rely(); diff --git a/src/test/incorrect/iflocal/clang/iflocal.expected b/src/test/incorrect/iflocal/clang/iflocal.expected index 3eb181939..9be5ec85b 100644 --- a/src/test/incorrect/iflocal/clang/iflocal.expected +++ b/src/test/incorrect/iflocal/clang/iflocal.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -197,7 +197,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%000002f5"} true; @@ -219,28 +219,31 @@ procedure main() } goto l00000337; l00000337: + assume {:captureState "l00000337"} true; R8, Gamma_R8 := 1bv64, true; goto l0000033a; l00000334: + assume {:captureState "l00000334"} true; R8, Gamma_R8 := 0bv64, true; goto l0000033a; l0000033a: + assume {:captureState "l0000033a"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000342; } goto l00000359; l00000359: - assume {:captureState "addr:l00000359"} true; + assume {:captureState "l00000359"} true; goto l0000035a; l0000035a: - assume {:captureState "addr:l0000035a"} true; + assume {:captureState "l0000035a"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); assume {:captureState "%00000368"} true; goto l00000342; l00000342: - assume {:captureState "addr:l00000342"} true; + assume {:captureState "l00000342"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/iflocal/clang_no_plt_no_pic/iflocal.expected b/src/test/incorrect/iflocal/clang_no_plt_no_pic/iflocal.expected index fd0978448..8fa6934a5 100644 --- a/src/test/incorrect/iflocal/clang_no_plt_no_pic/iflocal.expected +++ b/src/test/incorrect/iflocal/clang_no_plt_no_pic/iflocal.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -197,7 +197,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000917"} true; @@ -219,28 +219,31 @@ procedure main() } goto l00000959; l00000959: + assume {:captureState "l00000959"} true; R8, Gamma_R8 := 1bv64, true; goto l0000095c; l00000956: + assume {:captureState "l00000956"} true; R8, Gamma_R8 := 0bv64, true; goto l0000095c; l0000095c: + assume {:captureState "l0000095c"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000964; } goto l0000097b; l0000097b: - assume {:captureState "addr:l0000097b"} true; + assume {:captureState "l0000097b"} true; goto l0000097c; l0000097c: - assume {:captureState "addr:l0000097c"} true; + assume {:captureState "l0000097c"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); assume {:captureState "%0000098a"} true; goto l00000964; l00000964: - assume {:captureState "addr:l00000964"} true; + assume {:captureState "l00000964"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/iflocal/clang_pic/iflocal.expected b/src/test/incorrect/iflocal/clang_pic/iflocal.expected index fd0978448..8fa6934a5 100644 --- a/src/test/incorrect/iflocal/clang_pic/iflocal.expected +++ b/src/test/incorrect/iflocal/clang_pic/iflocal.expected @@ -1,44 +1,44 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -79,7 +79,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -88,9 +88,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -197,7 +197,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000917"} true; @@ -219,28 +219,31 @@ procedure main() } goto l00000959; l00000959: + assume {:captureState "l00000959"} true; R8, Gamma_R8 := 1bv64, true; goto l0000095c; l00000956: + assume {:captureState "l00000956"} true; R8, Gamma_R8 := 0bv64, true; goto l0000095c; l0000095c: + assume {:captureState "l0000095c"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000964; } goto l0000097b; l0000097b: - assume {:captureState "addr:l0000097b"} true; + assume {:captureState "l0000097b"} true; goto l0000097c; l0000097c: - assume {:captureState "addr:l0000097c"} true; + assume {:captureState "l0000097c"} true; R8, Gamma_R8 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); assume {:captureState "%0000098a"} true; goto l00000964; l00000964: - assume {:captureState "addr:l00000964"} true; + assume {:captureState "l00000964"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/iflocal/gcc/iflocal.expected b/src/test/incorrect/iflocal/gcc/iflocal.expected index 77f4caea5..a5b449c83 100644 --- a/src/test/incorrect/iflocal/gcc/iflocal.expected +++ b/src/test/incorrect/iflocal/gcc/iflocal.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,9 +86,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -195,7 +195,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000002e6"} true; @@ -214,13 +214,13 @@ procedure main() } goto l0000032d; l0000032d: - assume {:captureState "addr:l0000032d"} true; + assume {:captureState "l0000032d"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); assume {:captureState "%00000338"} true; goto l00000318; l00000318: - assume {:captureState "addr:l00000318"} true; + assume {:captureState "l00000318"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/incorrect/iflocal/gcc_no_plt_no_pic/iflocal.expected b/src/test/incorrect/iflocal/gcc_no_plt_no_pic/iflocal.expected index d3414cf83..185882037 100644 --- a/src/test/incorrect/iflocal/gcc_no_plt_no_pic/iflocal.expected +++ b/src/test/incorrect/iflocal/gcc_no_plt_no_pic/iflocal.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,9 +86,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -195,7 +195,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000008cd"} true; @@ -214,13 +214,13 @@ procedure main() } goto l00000914; l00000914: - assume {:captureState "addr:l00000914"} true; + assume {:captureState "l00000914"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); assume {:captureState "%0000091f"} true; goto l000008ff; l000008ff: - assume {:captureState "addr:l000008ff"} true; + assume {:captureState "l000008ff"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/incorrect/iflocal/gcc_pic/iflocal.expected b/src/test/incorrect/iflocal/gcc_pic/iflocal.expected index d3414cf83..185882037 100644 --- a/src/test/incorrect/iflocal/gcc_pic/iflocal.expected +++ b/src/test/incorrect/iflocal/gcc_pic/iflocal.expected @@ -1,42 +1,42 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -77,7 +77,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -86,9 +86,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -195,7 +195,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%000008cd"} true; @@ -214,13 +214,13 @@ procedure main() } goto l00000914; l00000914: - assume {:captureState "addr:l00000914"} true; + assume {:captureState "l00000914"} true; R0, Gamma_R0 := 1bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); assume {:captureState "%0000091f"} true; goto l000008ff; l000008ff: - assume {:captureState "addr:l000008ff"} true; + assume {:captureState "l000008ff"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/incorrect/nestedifglobal/clang/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/clang/nestedifglobal.expected index 4077c58eb..a084acbaf 100644 --- a/src/test/incorrect/nestedifglobal/clang/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/clang/nestedifglobal.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,9 +94,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -207,7 +207,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000345"} true; @@ -235,28 +235,31 @@ procedure main() } goto l00000393; l00000393: + assume {:captureState "l00000393"} true; R8, Gamma_R8 := 1bv64, true; goto l00000396; l00000390: + assume {:captureState "l00000390"} true; R8, Gamma_R8 := 0bv64, true; goto l00000396; l00000396: + assume {:captureState "l00000396"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l0000039e; } goto l0000045d; l0000045d: - assume {:captureState "addr:l0000045d"} true; + assume {:captureState "l0000045d"} true; goto l0000045e; l0000045e: - assume {:captureState "addr:l0000045e"} true; + assume {:captureState "l0000045e"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); assume {:captureState "%0000046c"} true; goto l0000039e; l0000039e: - assume {:captureState "addr:l0000039e"} true; + assume {:captureState "l0000039e"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -272,28 +275,31 @@ procedure main() } goto l000003d1; l000003d1: + assume {:captureState "l000003d1"} true; R8, Gamma_R8 := 1bv64, true; goto l000003d4; l000003ce: + assume {:captureState "l000003ce"} true; R8, Gamma_R8 := 0bv64, true; goto l000003d4; l000003d4: + assume {:captureState "l000003d4"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l000003dc; } goto l00000448; l00000448: - assume {:captureState "addr:l00000448"} true; + assume {:captureState "l00000448"} true; goto l00000449; l00000449: - assume {:captureState "addr:l00000449"} true; + assume {:captureState "l00000449"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); assume {:captureState "%00000457"} true; goto l000003dc; l000003dc: - assume {:captureState "addr:l000003dc"} true; + assume {:captureState "l000003dc"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #6, Gamma_#6 := bvadd32(R8[32:0], 4294967292bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934589bv33))), (Gamma_R8 && Gamma_#6); @@ -307,22 +313,25 @@ procedure main() } goto l0000040a; l0000040a: + assume {:captureState "l0000040a"} true; R8, Gamma_R8 := 1bv64, true; goto l0000040d; l00000407: + assume {:captureState "l00000407"} true; R8, Gamma_R8 := 0bv64, true; goto l0000040d; l0000040d: + assume {:captureState "l0000040d"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000415; } goto l0000042c; l0000042c: - assume {:captureState "addr:l0000042c"} true; + assume {:captureState "l0000042c"} true; goto l0000042d; l0000042d: - assume {:captureState "addr:l0000042d"} true; + assume {:captureState "l0000042d"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); @@ -330,7 +339,7 @@ procedure main() assume {:captureState "%00000442"} true; goto l00000415; l00000415: - assume {:captureState "addr:l00000415"} true; + assume {:captureState "l00000415"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/nestedifglobal/clang_no_plt_no_pic/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/clang_no_plt_no_pic/nestedifglobal.expected index 4ea94364b..ded3f676a 100644 --- a/src/test/incorrect/nestedifglobal/clang_no_plt_no_pic/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/clang_no_plt_no_pic/nestedifglobal.expected @@ -1,50 +1,50 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -85,7 +85,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69678bv64) == 0bv8); free ensures (memory_load8_le(mem, 69679bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -94,9 +94,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -207,7 +207,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), 0bv32), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), true); assume {:captureState "%00000a95"} true; @@ -235,28 +235,31 @@ procedure main() } goto l00000ae3; l00000ae3: + assume {:captureState "l00000ae3"} true; R8, Gamma_R8 := 1bv64, true; goto l00000ae6; l00000ae0: + assume {:captureState "l00000ae0"} true; R8, Gamma_R8 := 0bv64, true; goto l00000ae6; l00000ae6: + assume {:captureState "l00000ae6"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000aee; } goto l00000bad; l00000bad: - assume {:captureState "addr:l00000bad"} true; + assume {:captureState "l00000bad"} true; goto l00000bae; l00000bae: - assume {:captureState "addr:l00000bae"} true; + assume {:captureState "l00000bae"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); assume {:captureState "%00000bbc"} true; goto l00000aee; l00000aee: - assume {:captureState "addr:l00000aee"} true; + assume {:captureState "l00000aee"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 52bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 52bv64)) || L(mem, bvadd64(R8, 52bv64))); @@ -272,28 +275,31 @@ procedure main() } goto l00000b21; l00000b21: + assume {:captureState "l00000b21"} true; R8, Gamma_R8 := 1bv64, true; goto l00000b24; l00000b1e: + assume {:captureState "l00000b1e"} true; R8, Gamma_R8 := 0bv64, true; goto l00000b24; l00000b24: + assume {:captureState "l00000b24"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000b2c; } goto l00000b98; l00000b98: - assume {:captureState "addr:l00000b98"} true; + assume {:captureState "l00000b98"} true; goto l00000b99; l00000b99: - assume {:captureState "addr:l00000b99"} true; + assume {:captureState "l00000b99"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 4bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 4bv64), Gamma_R8); assume {:captureState "%00000ba7"} true; goto l00000b2c; l00000b2c: - assume {:captureState "addr:l00000b2c"} true; + assume {:captureState "l00000b2c"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 4bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 4bv64)); #6, Gamma_#6 := bvadd32(R8[32:0], 4294967292bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934589bv33))), (Gamma_R8 && Gamma_#6); @@ -307,22 +313,25 @@ procedure main() } goto l00000b5a; l00000b5a: + assume {:captureState "l00000b5a"} true; R8, Gamma_R8 := 1bv64, true; goto l00000b5d; l00000b57: + assume {:captureState "l00000b57"} true; R8, Gamma_R8 := 0bv64, true; goto l00000b5d; l00000b5d: + assume {:captureState "l00000b5d"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000b65; } goto l00000b7c; l00000b7c: - assume {:captureState "addr:l00000b7c"} true; + assume {:captureState "l00000b7c"} true; goto l00000b7d; l00000b7d: - assume {:captureState "addr:l00000b7d"} true; + assume {:captureState "l00000b7d"} true; R8, Gamma_R8 := 69632bv64, true; call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, bvadd64(R8, 56bv64))), (gamma_load32(Gamma_mem, bvadd64(R8, 56bv64)) || L(mem, bvadd64(R8, 56bv64))); @@ -330,7 +339,7 @@ procedure main() assume {:captureState "%00000b92"} true; goto l00000b65; l00000b65: - assume {:captureState "addr:l00000b65"} true; + assume {:captureState "l00000b65"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64)); R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31; return; diff --git a/src/test/incorrect/nestedifglobal/clang_pic/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/clang_pic/nestedifglobal.expected index 7f641b4cb..a333a5bcf 100644 --- a/src/test/incorrect/nestedifglobal/clang_pic/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/clang_pic/nestedifglobal.expected @@ -1,66 +1,66 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_R8: bool; -var {:extern } Gamma_R9: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R31: bv64; -var {:extern } R8: bv64; -var {:extern } R9: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_R8: bool; +var {:extern} Gamma_R9: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R31: bv64; +var {:extern} R8: bv64; +var {:extern} R9: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store64(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value][bvadd64(index, 4bv64) := value][bvadd64(index, 5bv64) := value][bvadd64(index, 6bv64) := value][bvadd64(index, 7bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { +function {:extern} memory_store64_le(memory: [bv64]bv8, index: bv64, value: bv64) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]][bvadd64(index, 4bv64) := value[40:32]][bvadd64(index, 5bv64) := value[48:40]][bvadd64(index, 6bv64) := value[56:48]][bvadd64(index, 7bv64) := value[64:56]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -117,7 +117,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69062bv64) == 0bv8); free ensures (memory_load8_le(mem, 69063bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -126,9 +126,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -271,7 +271,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; R8, Gamma_R8 := 65536bv64, true; call rely(); @@ -303,28 +303,31 @@ procedure main() } goto l000003ae; l000003ae: + assume {:captureState "l000003ae"} true; R8, Gamma_R8 := 1bv64, true; goto l000003b1; l000003ab: + assume {:captureState "l000003ab"} true; R8, Gamma_R8 := 0bv64, true; goto l000003b1; l000003b1: + assume {:captureState "l000003b1"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l000003b9; } goto l00000481; l00000481: - assume {:captureState "addr:l00000481"} true; + assume {:captureState "l00000481"} true; goto l00000482; l00000482: - assume {:captureState "addr:l00000482"} true; + assume {:captureState "l00000482"} true; R8, Gamma_R8 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R8); assume {:captureState "%00000490"} true; goto l000003b9; l000003b9: - assume {:captureState "addr:l000003b9"} true; + assume {:captureState "l000003b9"} true; R8, Gamma_R8 := memory_load64_le(stack, bvadd64(R31, 8bv64)), gamma_load64(Gamma_stack, bvadd64(R31, 8bv64)); call rely(); R8, Gamma_R8 := zero_extend32_32(memory_load32_le(mem, R8)), (gamma_load32(Gamma_mem, R8) || L(mem, R8)); @@ -340,28 +343,31 @@ procedure main() } goto l000003ee; l000003ee: + assume {:captureState "l000003ee"} true; R8, Gamma_R8 := 1bv64, true; goto l000003f1; l000003eb: + assume {:captureState "l000003eb"} true; R8, Gamma_R8 := 0bv64, true; goto l000003f1; l000003f1: + assume {:captureState "l000003f1"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l000003f9; } goto l0000046c; l0000046c: - assume {:captureState "addr:l0000046c"} true; + assume {:captureState "l0000046c"} true; goto l0000046d; l0000046d: - assume {:captureState "addr:l0000046d"} true; + assume {:captureState "l0000046d"} true; R8, Gamma_R8 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 20bv64), R8[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 20bv64), Gamma_R8); assume {:captureState "%0000047b"} true; goto l000003f9; l000003f9: - assume {:captureState "addr:l000003f9"} true; + assume {:captureState "l000003f9"} true; R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 20bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 20bv64)); #6, Gamma_#6 := bvadd32(R8[32:0], 4294967292bv32), Gamma_R8; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R8[32:0]), 8589934589bv33))), (Gamma_R8 && Gamma_#6); @@ -375,22 +381,25 @@ procedure main() } goto l00000427; l00000427: + assume {:captureState "l00000427"} true; R8, Gamma_R8 := 1bv64, true; goto l0000042a; l00000424: + assume {:captureState "l00000424"} true; R8, Gamma_R8 := 0bv64, true; goto l0000042a; l0000042a: + assume {:captureState "l0000042a"} true; assert Gamma_R8; if ((bvcomp1(R8[1:0], 1bv1) != 0bv1)) { goto l00000432; } goto l00000449; l00000449: - assume {:captureState "addr:l00000449"} true; + assume {:captureState "l00000449"} true; goto l0000044a; l0000044a: - assume {:captureState "addr:l0000044a"} true; + assume {:captureState "l0000044a"} true; R8, Gamma_R8 := 65536bv64, true; call rely(); R8, Gamma_R8 := memory_load64_le(mem, bvadd64(R8, 4032bv64)), (gamma_load64(Gamma_mem, bvadd64(R8, 4032bv64)) || L(mem, bvadd64(R8, 4032bv64))); @@ -400,7 +409,7 @@ procedure main() assume {:captureState "%00000466"} true; goto l00000432; l00000432: - assume {:captureState "addr:l00000432"} true; + assume {:captureState "l00000432"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/incorrect/nestedifglobal/gcc/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/gcc/nestedifglobal.expected index b5ba5f23b..8fd6d9f25 100644 --- a/src/test/incorrect/nestedifglobal/gcc/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/gcc/nestedifglobal.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,9 +92,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -205,7 +205,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000332"} true; @@ -233,13 +233,13 @@ procedure main() } goto l00000414; l00000414: - assume {:captureState "addr:l00000414"} true; + assume {:captureState "l00000414"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); assume {:captureState "%0000041f"} true; goto l00000381; l00000381: - assume {:captureState "addr:l00000381"} true; + assume {:captureState "l00000381"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -255,13 +255,13 @@ procedure main() } goto l00000407; l00000407: - assume {:captureState "addr:l00000407"} true; + assume {:captureState "l00000407"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); assume {:captureState "%00000412"} true; goto l000003b2; l000003b2: - assume {:captureState "addr:l000003b2"} true; + assume {:captureState "l000003b2"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#6); @@ -274,7 +274,7 @@ procedure main() } goto l000003ed; l000003ed: - assume {:captureState "addr:l000003ed"} true; + assume {:captureState "l000003ed"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -283,7 +283,7 @@ procedure main() assume {:captureState "%00000405"} true; goto l000003d8; l000003d8: - assume {:captureState "addr:l000003d8"} true; + assume {:captureState "l000003d8"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/incorrect/nestedifglobal/gcc_no_plt_no_pic/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/gcc_no_plt_no_pic/nestedifglobal.expected index 8a807f45e..f53463dad 100644 --- a/src/test/incorrect/nestedifglobal/gcc_no_plt_no_pic/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/gcc_no_plt_no_pic/nestedifglobal.expected @@ -1,48 +1,48 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -83,7 +83,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69646bv64) == 0bv8); free ensures (memory_load8_le(mem, 69647bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -92,9 +92,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -205,7 +205,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000a2a"} true; @@ -233,13 +233,13 @@ procedure main() } goto l00000b0c; l00000b0c: - assume {:captureState "addr:l00000b0c"} true; + assume {:captureState "l00000b0c"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); assume {:captureState "%00000b17"} true; goto l00000a79; l00000a79: - assume {:captureState "addr:l00000a79"} true; + assume {:captureState "l00000a79"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 20bv64), Gamma_R0; call rely(); @@ -255,13 +255,13 @@ procedure main() } goto l00000aff; l00000aff: - assume {:captureState "addr:l00000aff"} true; + assume {:captureState "l00000aff"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); assume {:captureState "%00000b0a"} true; goto l00000aaa; l00000aaa: - assume {:captureState "addr:l00000aaa"} true; + assume {:captureState "l00000aaa"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#6); @@ -274,7 +274,7 @@ procedure main() } goto l00000ae5; l00000ae5: - assume {:captureState "addr:l00000ae5"} true; + assume {:captureState "l00000ae5"} true; R0, Gamma_R0 := 69632bv64, true; R0, Gamma_R0 := bvadd64(R0, 24bv64), Gamma_R0; call rely(); @@ -283,7 +283,7 @@ procedure main() assume {:captureState "%00000afd"} true; goto l00000ad0; l00000ad0: - assume {:captureState "addr:l00000ad0"} true; + assume {:captureState "l00000ad0"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return; diff --git a/src/test/incorrect/nestedifglobal/gcc_pic/nestedifglobal.expected b/src/test/incorrect/nestedifglobal/gcc_pic/nestedifglobal.expected index d81d1a186..33b87b289 100644 --- a/src/test/incorrect/nestedifglobal/gcc_pic/nestedifglobal.expected +++ b/src/test/incorrect/nestedifglobal/gcc_pic/nestedifglobal.expected @@ -1,56 +1,56 @@ -var {:extern } Gamma_R0: bool; -var {:extern } Gamma_R1: bool; -var {:extern } Gamma_R31: bool; -var {:extern } Gamma_mem: [bv64]bool; -var {:extern } Gamma_stack: [bv64]bool; -var {:extern } R0: bv64; -var {:extern } R1: bv64; -var {:extern } R31: bv64; -var {:extern } mem: [bv64]bv8; -var {:extern } stack: [bv64]bv8; -function {:extern } L(memory: [bv64]bv8, index: bv64) returns (bool) { +var {:extern} Gamma_R0: bool; +var {:extern} Gamma_R1: bool; +var {:extern} Gamma_R31: bool; +var {:extern} Gamma_mem: [bv64]bool; +var {:extern} Gamma_stack: [bv64]bool; +var {:extern} R0: bv64; +var {:extern} R1: bv64; +var {:extern} R31: bv64; +var {:extern} mem: [bv64]bv8; +var {:extern} stack: [bv64]bv8; +function {:extern} L(memory: [bv64]bv8, index: bv64) returns (bool) { false } -function {:extern } {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); -function {:extern } {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); -function {:extern } {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); -function {:extern } {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); -function {:extern } {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); -function {:extern } gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} {:bvbuiltin "bvadd"} bvadd32(bv32, bv32) returns (bv32); +function {:extern} {:bvbuiltin "bvadd"} bvadd33(bv33, bv33) returns (bv33); +function {:extern} {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp1(bv1, bv1) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp32(bv32, bv32) returns (bv1); +function {:extern} {:bvbuiltin "bvcomp"} bvcomp33(bv33, bv33) returns (bv1); +function {:extern} {:bvbuiltin "bvnot"} bvnot1(bv1) returns (bv1); +function {:extern} gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))) } -function {:extern } gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { +function {:extern} gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) { (gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index]))))))) } -function {:extern } gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { +function {:extern} gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) { gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value] } -function {:extern } memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { +function {:extern} memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) { (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))) } -function {:extern } memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { +function {:extern} memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) { (memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index]))))))) } -function {:extern } memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { +function {:extern} memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) { memory[index] } -function {:extern } memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { +function {:extern} memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) { memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]] } -function {:extern } {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); -function {:extern } {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); -procedure {:extern } rely(); +function {:extern} {:bvbuiltin "sign_extend 1"} sign_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 1"} zero_extend1_32(bv32) returns (bv33); +function {:extern} {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64); +procedure {:extern} rely(); modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -107,7 +107,7 @@ procedure {:extern } rely(); free ensures (memory_load8_le(mem, 69006bv64) == 0bv8); free ensures (memory_load8_le(mem, 69007bv64) == 0bv8); -procedure {:extern } rely_transitive() +procedure {:extern} rely_transitive() modifies Gamma_mem, mem; ensures (mem == old(mem)); ensures (Gamma_mem == old(Gamma_mem)); @@ -116,9 +116,9 @@ procedure {:extern } rely_transitive() call rely(); } -procedure {:extern } rely_reflexive(); +procedure {:extern} rely_reflexive(); -procedure {:extern } guarantee_reflexive(); +procedure {:extern} guarantee_reflexive(); modifies Gamma_mem, mem; procedure main() @@ -261,7 +261,7 @@ procedure main() var VF: bv1; var ZF: bv1; lmain: - assume {:captureState "addr:lmain"} true; + assume {:captureState "lmain"} true; R31, Gamma_R31 := bvadd64(R31, 18446744073709551584bv64), Gamma_R31; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0); assume {:captureState "%00000332"} true; @@ -291,13 +291,13 @@ procedure main() } goto l00000418; l00000418: - assume {:captureState "addr:l00000418"} true; + assume {:captureState "l00000418"} true; R0, Gamma_R0 := 3bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); assume {:captureState "%00000423"} true; goto l00000383; l00000383: - assume {:captureState "addr:l00000383"} true; + assume {:captureState "l00000383"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4064bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4064bv64)) || L(mem, bvadd64(R0, 4064bv64))); @@ -314,13 +314,13 @@ procedure main() } goto l0000040b; l0000040b: - assume {:captureState "addr:l0000040b"} true; + assume {:captureState "l0000040b"} true; R0, Gamma_R0 := 5bv64, true; stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 28bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 28bv64), Gamma_R0); assume {:captureState "%00000416"} true; goto l000003b5; l000003b5: - assume {:captureState "addr:l000003b5"} true; + assume {:captureState "l000003b5"} true; R0, Gamma_R0 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 28bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 28bv64)); #6, Gamma_#6 := bvadd32(R0[32:0], 4294967292bv32), Gamma_R0; VF, Gamma_VF := bvnot1(bvcomp33(sign_extend1_32(bvadd32(#6, 1bv32)), bvadd33(sign_extend1_32(R0[32:0]), 8589934589bv33))), (Gamma_R0 && Gamma_#6); @@ -333,7 +333,7 @@ procedure main() } goto l000003f0; l000003f0: - assume {:captureState "addr:l000003f0"} true; + assume {:captureState "l000003f0"} true; R0, Gamma_R0 := 65536bv64, true; call rely(); R0, Gamma_R0 := memory_load64_le(mem, bvadd64(R0, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R0, 4056bv64)) || L(mem, bvadd64(R0, 4056bv64))); @@ -343,7 +343,7 @@ procedure main() assume {:captureState "%00000409"} true; goto l000003db; l000003db: - assume {:captureState "addr:l000003db"} true; + assume {:captureState "l000003db"} true; R0, Gamma_R0 := 0bv64, true; R31, Gamma_R31 := bvadd64(R31, 32bv64), Gamma_R31; return;