| 1 |
# frama-c -wp [...] |
| 2 |
[kernel] Parsing looplabels.i (no preprocessing) |
| 3 |
[wp] Running WP plugin... |
| 4 |
[wp] Warning: Missing RTE guards |
| 5 |
------------------------------------------------------------ |
| 6 |
Function copy |
| 7 |
------------------------------------------------------------ |
| 8 |
|
| 9 |
Goal Post-condition (file looplabels.i, line 13) in 'copy': |
| 10 |
Let a_1 = shift_sint32(b, 0). |
| 11 |
Let a_2 = shift_sint32(a, 0). |
| 12 |
Assume { |
| 13 |
Type: is_sint32(i) /\ is_sint32(n). |
| 14 |
(* Heap *) |
| 15 |
Type: (region(a.base) <= 0) /\ (region(b.base) <= 0) /\ linked(Malloc_0). |
| 16 |
(* Pre-condition *) |
| 17 |
Have: 0 < n. |
| 18 |
(* Pre-condition *) |
| 19 |
Have: valid_rw(Malloc_0, a_2, n). |
| 20 |
(* Pre-condition *) |
| 21 |
Have: valid_rw(Malloc_0, a_1, n). |
| 22 |
(* Pre-condition *) |
| 23 |
Have: separated(a_2, n, a_1, n). |
| 24 |
(* Invariant *) |
| 25 |
Have: P_IsEqual(Mint_0, a, b, 0). |
| 26 |
(* Invariant *) |
| 27 |
Have: (0 <= i) /\ (i <= n). |
| 28 |
(* Invariant *) |
| 29 |
Have: P_IsEqual(havoc(Mint_undef_0, Mint_0, a_1, n), a, b, i). |
| 30 |
(* Else *) |
| 31 |
Have: n <= i. |
| 32 |
} |
| 33 |
Prove: P_IsEqual(havoc(Mint_undef_0, Mint_0, a_1, i), a, b, i). |
| 34 |
|
| 35 |
------------------------------------------------------------ |
| 36 |
|
| 37 |
Goal Preservation of Invariant (file looplabels.i, line 18): |
| 38 |
Prove: true. |
| 39 |
|
| 40 |
------------------------------------------------------------ |
| 41 |
|
| 42 |
Goal Establishment of Invariant (file looplabels.i, line 18): |
| 43 |
Prove: true. |
| 44 |
|
| 45 |
------------------------------------------------------------ |
| 46 |
|
| 47 |
Goal Preservation of Invariant (file looplabels.i, line 19): |
| 48 |
Let a_1 = shift_sint32(b, 0). |
| 49 |
Let a_2 = havoc(Mint_undef_0, Mint_0, a_1, n). |
| 50 |
Let a_3 = shift_sint32(a, 0). |
| 51 |
Let x = 1 + i. |
| 52 |
Assume { |
| 53 |
Type: is_sint32(i) /\ is_sint32(n) /\ is_sint32(x). |
| 54 |
(* Heap *) |
| 55 |
Type: (region(a.base) <= 0) /\ (region(b.base) <= 0) /\ linked(Malloc_0). |
| 56 |
(* Pre-condition *) |
| 57 |
Have: 0 < n. |
| 58 |
(* Pre-condition *) |
| 59 |
Have: valid_rw(Malloc_0, a_3, n). |
| 60 |
(* Pre-condition *) |
| 61 |
Have: valid_rw(Malloc_0, a_1, n). |
| 62 |
(* Pre-condition *) |
| 63 |
Have: separated(a_3, n, a_1, n). |
| 64 |
(* Invariant *) |
| 65 |
Have: P_IsEqual(Mint_0, a, b, 0). |
| 66 |
(* Invariant *) |
| 67 |
Have: (0 <= i) /\ (i <= n). |
| 68 |
(* Invariant *) |
| 69 |
Have: P_IsEqual(a_2, a, b, i). |
| 70 |
(* Then *) |
| 71 |
Have: i < n. |
| 72 |
(* Invariant *) |
| 73 |
Have: (-1) <= i. |
| 74 |
} |
| 75 |
Prove: P_IsEqual(a_2[shift_sint32(b, i) <- a_2[shift_sint32(a, i)]], a, b, x). |
| 76 |
|
| 77 |
------------------------------------------------------------ |
| 78 |
|
| 79 |
Goal Establishment of Invariant (file looplabels.i, line 19): |
| 80 |
Let a_1 = shift_sint32(a, 0). |
| 81 |
Let a_2 = shift_sint32(b, 0). |
| 82 |
Assume { |
| 83 |
Type: is_sint32(n). |
| 84 |
(* Heap *) |
| 85 |
Type: (region(a.base) <= 0) /\ (region(b.base) <= 0) /\ linked(Malloc_0). |
| 86 |
(* Pre-condition *) |
| 87 |
Have: 0 < n. |
| 88 |
(* Pre-condition *) |
| 89 |
Have: valid_rw(Malloc_0, a_1, n). |
| 90 |
(* Pre-condition *) |
| 91 |
Have: valid_rw(Malloc_0, a_2, n). |
| 92 |
(* Pre-condition *) |
| 93 |
Have: separated(a_1, n, a_2, n). |
| 94 |
} |
| 95 |
Prove: P_IsEqual(Mint_0, a, b, 0). |
| 96 |
|
| 97 |
------------------------------------------------------------ |
| 98 |
|
| 99 |
Goal Loop assigns (file looplabels.i, line 20) (1/2): |
| 100 |
Prove: true. |
| 101 |
|
| 102 |
------------------------------------------------------------ |
| 103 |
|
| 104 |
Goal Loop assigns (file looplabels.i, line 20) (2/2): |
| 105 |
Effect at line 23 |
| 106 |
Let a_1 = shift_sint32(b, 0). |
| 107 |
Let a_2 = havoc(Mint_undef_0, Mint_0, a_1, n). |
| 108 |
Let x = i - 1. |
| 109 |
Let a_3 = shift_sint32(b, x). |
| 110 |
Let a_4 = shift_sint32(a, 0). |
| 111 |
Assume { |
| 112 |
Type: is_sint32(i) /\ is_sint32(n) /\ is_sint32(x). |
| 113 |
(* Heap *) |
| 114 |
Type: (region(a.base) <= 0) /\ (region(b.base) <= 0) /\ linked(Malloc_0). |
| 115 |
(* Goal *) |
| 116 |
When: !invalid(Malloc_0, a_3, 1). |
| 117 |
(* Pre-condition *) |
| 118 |
Have: 0 < n. |
| 119 |
(* Pre-condition *) |
| 120 |
Have: valid_rw(Malloc_0, a_4, n). |
| 121 |
(* Pre-condition *) |
| 122 |
Have: valid_rw(Malloc_0, a_1, n). |
| 123 |
(* Pre-condition *) |
| 124 |
Have: separated(a_4, n, a_1, n). |
| 125 |
(* Invariant *) |
| 126 |
Have: P_IsEqual(Mint_0, a, b, 0). |
| 127 |
(* Invariant *) |
| 128 |
Have: (0 < i) /\ (i <= (1 + n)). |
| 129 |
(* Invariant *) |
| 130 |
Have: P_IsEqual(a_2, a, b, x). |
| 131 |
(* Then *) |
| 132 |
Have: i <= n. |
| 133 |
(* Invariant *) |
| 134 |
Have: P_IsEqual(a_2[a_3 <- a_2[shift_sint32(a, x)]], a, b, i). |
| 135 |
} |
| 136 |
Prove: included(a_3, 1, a_1, n). |
| 137 |
|
| 138 |
------------------------------------------------------------ |
| 139 |
|
| 140 |
Goal Assigns (file looplabels.i, line 14) in 'copy': |
| 141 |
Effect at line 22 |
| 142 |
Prove: true. |
| 143 |
|
| 144 |
------------------------------------------------------------ |