Commit a636c05
Contracts & Harnesses for wrapping_shr (model-checking#123)
Towards model-checking#59
Changes
Added contracts for wrapping_shr (located in
library/core/src/num/int_macros.rs and uint_macros.rs)
Added harnesses for wrapping_shr of each integer type
i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize --- 12
harnesses in total.
Revalidation
Per the discussion in
model-checking#59, we have to
build and run Kani from feature/verify-rust-std branch.
To revalidate the verification results, run the following command.
<harness_to_run> can be either num::verify to run all harnesses or
num::verify::<harness_name> (e.g. checked_wrapping_shl_i8) to run a
specific harness.
```
kani verify-std "path/to/library" \
--harness <harness_to_run> \
-Z unstable-options \
-Z function-contracts \
-Z mem-predicates
```
All harnesses should pass the default checks (1251 checks where 1
unreachable).
```
SUMMARY:
** 0 of 161 failed (1 unreachable)
VERIFICATION:- SUCCESSFUL
Verification Time: 0.32086188s
Complete - 12 successfully verified harnesses, 0 failures, 12 total.
```
Example of the unreachable check:
```
Check 9: num::<impl i8>::wrapping_shr.assertion.1
- Status: UNREACHABLE
- Description: "attempt to subtract with overflow"
- Location: library/core/src/num/int_macros.rs:2199:42 in function num::<impl i8>::wrapping_shr
```
---------
Co-authored-by: Yenyun035 <[email protected]>1 parent 3a967e3 commit a636c05
3 files changed
+26
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2191 | 2191 | | |
2192 | 2192 | | |
2193 | 2193 | | |
| 2194 | + | |
2194 | 2195 | | |
2195 | 2196 | | |
2196 | 2197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1943 | 1943 | | |
1944 | 1944 | | |
1945 | 1945 | | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
1946 | 1970 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2172 | 2172 | | |
2173 | 2173 | | |
2174 | 2174 | | |
| 2175 | + | |
2175 | 2176 | | |
2176 | 2177 | | |
2177 | 2178 | | |
| |||
0 commit comments