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;