forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove temporary variables from translating MIR assert instructions (r…
…ust-lang#884) * Remove temporary variables from Assert instructions Use description function to get the user friendly message instead of using the debug display method. * Update test expected output * Enhanced test
- Loading branch information
Showing
25 changed files
with
109 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[overflow::simple_addition.assertion.1] line 7 attempt to compute `move _3 + move _4`, which would overflow: FAILURE | ||
[overflow::simple_addition.assertion.1] line 7 attempt to add with overflow: FAILURE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[bounds_check::get_wrapped.assertion.3] line 11 index out of bounds: the length is move _12 but the index is _5: FAILURE | ||
[bounds_check::get_wrapped.pointer_dereference.5] line 11 dereference failure: pointer outside object bounds in a.data[var_5]: FAILURE | ||
line 11 index out of bounds: the length is less than or equal to the given index | ||
line 11 dereference failure: pointer outside object bounds in a.data[var_5]: FAILURE | ||
VERIFICATION FAILED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[overflow_quicksort::find_midpoint.assertion.1] line 7 attempt to compute `move _4 + move _5`, which would overflow: FAILURE | ||
[overflow_quicksort::find_midpoint.assertion.1] line 7 attempt to add with overflow: FAILURE | ||
VERIFICATION FAILED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
line 20 attempt to compute `move _8 + move _9`, which would overflow: SUCCESS | ||
line 20 attempt to compute `move _5 + move _6`, which would overflow: SUCCESS | ||
line 20 attempt to compute `(*((*_1).0: &mut i32)) + move _4`, which would overflow: SUCCESS | ||
line 25 attempt to compute `move _18 + const 12_i32`, which would overflow: SUCCESS | ||
line 25 assertion failed: original_num + 12 == num: SUCCESS | ||
line 25 arithmetic overflow on signed + in var_18 + 12: SUCCESS | ||
attempt to add with overflow: SUCCESS | ||
attempt to add with overflow: SUCCESS | ||
attempt to add with overflow: SUCCESS | ||
attempt to add with overflow: SUCCESS | ||
assertion failed: original_num + 12 == num: SUCCESS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
line 7 attempt to compute `move _3 + move _4`, which would overflow: SUCCESS | ||
line 9 attempt to compute `move _3 + move _4`, which would overflow: SUCCESS | ||
line 7 attempt to add with overflow: SUCCESS | ||
line 9 attempt to add with overflow: SUCCESS | ||
line 10 assertion failed: z == 102: SUCCESS | ||
line 11 assertion failed: g(z) == 206: SUCCESS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
line 16 attempt to compute `move _3 + move _4`, which would overflow: SUCCESS | ||
line 17 attempt to compute `move _11 + const 10_i64`, which would overflow: SUCCESS | ||
line 16 attempt to add with overflow: SUCCESS | ||
line 17 attempt to add with overflow: SUCCESS | ||
line 17 assertion failed: num + 10 == y: SUCCESS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
line 7 attempt to compute `move _6 + move _7`, which would overflow: SUCCESS | ||
line 7 attempt to compute `move _10 + move _11`, which would overflow: SUCCESS | ||
line 7 attempt to add with overflow: SUCCESS | ||
line 7 attempt to add with overflow: SUCCESS | ||
line 7 assertion failed: a + b == b + a: SUCCESS | ||
line 8 attempt to compute `move _16 + move _17`, which would overflow: SUCCESS | ||
line 8 attempt to compute `move _21 + move _22`, which would overflow: SUCCESS | ||
line 8 attempt to compute `move _20 + const 1_i32`, which would overflow: SUCCESS | ||
line 8 attempt to add with overflow: SUCCESS | ||
line 8 attempt to add with overflow: SUCCESS | ||
line 8 attempt to add with overflow: SUCCESS | ||
line 8 assertion failed: a + b != a + b + 1: SUCCESS | ||
line 13 attempt to compute `move _6 + move _7`, which would overflow: SUCCESS | ||
line 13 attempt to add with overflow: SUCCESS | ||
line 13 assertion failed: a + b > a: SUCCESS | ||
line 14 attempt to compute `move _13 - move _14`, which would overflow: SUCCESS | ||
line 14 attempt to subtract with overflow: SUCCESS | ||
line 14 assertion failed: a - b < a: SUCCESS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
line 7 unreachable code: SUCCESS | ||
line 8 attempt to compute `_1 * move _10`, which would overflow: SUCCESS | ||
line 8 attempt to multiply with overflow: SUCCESS | ||
line 10 assertion failed: z == 6: SUCCESS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
line 9 attempt to compute `move _12 * move _13`, which would overflow: SUCCESS | ||
line 9 attempt to compute `const 2_i32 * move _16`, which would overflow: SUCCESS | ||
line 9 attempt to compute `move _11 - move _15`, which would overflow: SUCCESS | ||
line 9 attempt to compute `move _10 + const 1_i32`, which would overflow: SUCCESS | ||
line 9 attempt to multiply with overflow: SUCCESS | ||
line 9 attempt to multiply with overflow: SUCCESS | ||
line 9 attempt to subtract with overflow: SUCCESS | ||
line 9 attempt to add with overflow: SUCCESS | ||
line 9 assertion failed: x * x - 2 * x + 1 != 4 || (x == -1 || x == 3): SUCCESS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
line 17 assertion failed: y.len() == 5: SUCCESS | ||
line 18 index out of bounds: the length is move _16 but the index is _15: SUCCESS | ||
line 18 index out of bounds: the length is less than or equal to the given index: SUCCESS | ||
line 18 assertion failed: y[1] == 2: SUCCESS | ||
line 19 assertion failed: z.len() == 3: SUCCESS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
line 9 attempt to compute `_1 + move _4`, which would overflow: SUCCESS | ||
line 10 attempt to compute `_2 - const 1_i32`, which would overflow: SUCCESS | ||
line 9 attempt to add with overflow: SUCCESS | ||
line 10 attempt to subtract with overflow: SUCCESS | ||
line 14 assertion failed: a == 54: FAILURE | ||
line 16 assertion failed: a == 55: SUCCESS | ||
line 18 assertion failed: a >= 55: SUCCESS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
line 9 attempt to shift right by `const 1_i32`, which would overflow: SUCCESS | ||
line 10 attempt to compute `_2 + const 1_i32`, which would overflow: SUCCESS | ||
line 9 attempt to shift right with overflow: SUCCESS | ||
line 10 attempt to add with overflow: SUCCESS | ||
line 15 assertion failed: i == 3: FAILURE | ||
line 17 assertion failed: i == 2: SUCCESS | ||
line 19 assertion failed: i == 2 || i == 3: SUCCESS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
line 10 attempt to compute `_2 + const 1_i32`, which would overflow: SUCCESS | ||
line 10 attempt to add with overflow: SUCCESS | ||
line 15 assertion failed: i == 3: FAILURE | ||
line 17 assertion failed: i == 2: SUCCESS | ||
line 19 assertion failed: i == 2 || i == 3: SUCCESS | ||
line 23 attempt to divide `_3` by zero: SUCCESS | ||
line 23 attempt to compute `_3 / _4`, which would overflow: SUCCESS | ||
line 23 attempt to divide by zero: SUCCESS | ||
line 23 attempt to divide with overflow: SUCCESS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
line 7 assertion failed: div(4, 2) == 2: SUCCESS | ||
line 9 assertion failed: div(6, 2) == 2: FAILURE | ||
line 13 attempt to divide `_3` by zero: SUCCESS | ||
line 13 attempt to compute `_3 / _4`, which would overflow: SUCCESS | ||
line 13 attempt to divide by zero: SUCCESS | ||
line 13 attempt to divide with overflow: SUCCESS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Failed Checks: attempt to add with overflow | ||
Failed Checks: attempt to subtract with overflow | ||
Failed Checks: attempt to multiply with overflow | ||
Failed Checks: attempt to divide by zero | ||
Failed Checks: attempt to calculate the remainder with a divisor of zero | ||
Failed Checks: attempt to shift left with overflow | ||
Failed Checks: attempt to shift right with overflow | ||
Failed Checks: attempt to negate with overflow | ||
Failed Checks: index out of bounds: the length is less than or equal to the given index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
// | ||
// Check the message printed when a checked operation fails. | ||
// kani-flags: --unwind 3 | ||
extern crate kani; | ||
|
||
use kani::any; | ||
|
||
#[kani::proof] | ||
fn main() { | ||
let _ = any::<u8>() + any::<u8>(); | ||
let _ = any::<u8>() - any::<u8>(); | ||
let _ = any::<u8>() * any::<u8>(); | ||
let _ = any::<u8>() / any::<u8>(); | ||
let _ = any::<u8>() % any::<u8>(); | ||
let _ = any::<u8>() << any::<u8>(); | ||
let _ = any::<u8>() >> any::<u8>(); | ||
let _ = -any::<i8>(); | ||
let _ = kani::any::<[u8; 2]>()[any::<usize>()]; | ||
} |