-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unchecked/SIMD bitshift checks and disable CBMC flag (#2630)
Co-authored-by: Celina G. Val <celinval@amazon.com> Co-authored-by: Adrian Palacios <73246657+adpaco-aws@users.noreply.github.com>
- Loading branch information
1 parent
c15294e
commit 7fc9fa7
Showing
17 changed files
with
150 additions
and
58 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
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 was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
tests/expected/intrinsics/simd-shl-operand-negative/main.rs
This file was deleted.
Oops, something went wrong.
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 @@ | ||
FAILURE\ | ||
shift distance is negative | ||
attempt simd_shl with negative shift distance |
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,2 +1,2 @@ | ||
FAILURE\ | ||
shift distance too large | ||
attempt simd_shl with excessive shift distance |
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,2 +1,2 @@ | ||
FAILURE\ | ||
shift distance is negative | ||
attempt simd_shr with negative shift distance |
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,2 +1,2 @@ | ||
FAILURE\ | ||
shift distance too large | ||
attempt simd_shr with excessive shift distance |
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,23 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
// | ||
// Ensure that shifting negative values yields the expected results. | ||
|
||
#[kani::proof] | ||
#[kani::unwind(5)] | ||
fn sheck_shl() { | ||
let val: i32 = kani::any(); | ||
let dist: u8 = kani::any(); | ||
kani::assume(dist < 32); | ||
assert_eq!(val << dist, val.wrapping_mul(2_i32.wrapping_pow(dist.into()))); | ||
} | ||
|
||
#[kani::proof] | ||
#[kani::unwind(5)] | ||
fn check_shr() { | ||
let val: i32 = kani::any(); | ||
let dist: u8 = kani::any(); | ||
kani::assume(dist < 32); | ||
let result = (val as i64).div_euclid(2_i64.pow(dist.into())); | ||
assert_eq!(val >> dist, result as i32); | ||
} |
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,9 +1,9 @@ | ||
undefined-shift\ | ||
arithmetic_overflow\ | ||
Status: FAILURE\ | ||
Description: "shift distance too large" | ||
Description: "attempt to shift by excessive shift distance" | ||
|
||
Failed Checks: panicked on the `1` arm! | ||
Failed Checks: panicked on the `0` arm! | ||
Failed Checks: shift distance too large | ||
Failed Checks: attempt to shift by excessive shift distance | ||
|
||
VERIFICATION:- FAILED (encountered failures other than panics, which were unexpected) |