Implement checked Shl/Shr at MIR building.
This commit is contained in:
parent
43ee4d15bf
commit
dd582bd7db
7 changed files with 109 additions and 107 deletions
|
|
@ -12,13 +12,14 @@
|
|||
let mut _7: u32; // in scope 0 at $DIR/issue_101973.rs:+1:31: +1:52
|
||||
let mut _8: u32; // in scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
|
||||
let mut _9: u32; // in scope 0 at $DIR/issue_101973.rs:+1:33: +1:39
|
||||
let mut _10: (u32, bool); // in scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
|
||||
let mut _11: (u32, bool); // in scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
|
||||
let mut _10: i32; // in scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
|
||||
let mut _11: bool; // in scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
|
||||
let mut _12: i32; // in scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
|
||||
let mut _13: bool; // in scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
|
||||
scope 1 (inlined imm8) { // at $DIR/issue_101973.rs:14:5: 14:17
|
||||
debug x => _1; // in scope 1 at $DIR/issue_101973.rs:5:13: 5:14
|
||||
let mut _12: u32; // in scope 1 at $DIR/issue_101973.rs:7:12: 7:27
|
||||
let mut _13: u32; // in scope 1 at $DIR/issue_101973.rs:7:12: 7:20
|
||||
let mut _14: (u32, bool); // in scope 1 at $DIR/issue_101973.rs:7:12: 7:20
|
||||
let mut _14: u32; // in scope 1 at $DIR/issue_101973.rs:7:12: 7:27
|
||||
let mut _15: u32; // in scope 1 at $DIR/issue_101973.rs:7:12: 7:20
|
||||
scope 2 {
|
||||
debug out => _4; // in scope 2 at $DIR/issue_101973.rs:6:9: 6:16
|
||||
}
|
||||
|
|
@ -32,43 +33,46 @@
|
|||
StorageLive(_2); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:65
|
||||
StorageLive(_3); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:58
|
||||
StorageLive(_4); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:17
|
||||
StorageLive(_12); // scope 2 at $DIR/issue_101973.rs:7:12: 7:27
|
||||
StorageLive(_13); // scope 2 at $DIR/issue_101973.rs:7:12: 7:20
|
||||
_14 = CheckedShr(_1, const 0_i32); // scope 2 at $DIR/issue_101973.rs:7:12: 7:20
|
||||
assert(!move (_14.1: bool), "attempt to shift right by `{}`, which would overflow", const 0_i32) -> bb3; // scope 2 at $DIR/issue_101973.rs:7:12: 7:20
|
||||
StorageLive(_14); // scope 2 at $DIR/issue_101973.rs:7:12: 7:27
|
||||
StorageLive(_15); // scope 2 at $DIR/issue_101973.rs:7:12: 7:20
|
||||
_15 = Shr(_1, const 0_i32); // scope 2 at $DIR/issue_101973.rs:7:12: 7:20
|
||||
_14 = BitAnd(move _15, const 255_u32); // scope 2 at $DIR/issue_101973.rs:7:12: 7:27
|
||||
StorageDead(_15); // scope 2 at $DIR/issue_101973.rs:7:26: 7:27
|
||||
_4 = BitOr(const 0_u32, move _14); // scope 2 at $DIR/issue_101973.rs:7:5: 7:27
|
||||
StorageDead(_14); // scope 2 at $DIR/issue_101973.rs:7:26: 7:27
|
||||
StorageLive(_6); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
|
||||
StorageLive(_7); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:52
|
||||
StorageLive(_8); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
|
||||
- _10 = BitAnd(const 8_i32, const -32_i32); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
|
||||
- _11 = Ne(move _10, const 0_i32); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
|
||||
- assert(!move _11, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> bb1; // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
|
||||
+ _10 = const 0_i32; // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
|
||||
+ _11 = const false; // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
|
||||
+ assert(!const false, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> bb1; // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_8 = move (_10.0: u32); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
|
||||
_8 = Shr(_1, const 8_i32); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
|
||||
_7 = BitAnd(move _8, const 15_u32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:52
|
||||
StorageDead(_8); // scope 0 at $DIR/issue_101973.rs:+1:51: +1:52
|
||||
_11 = CheckedShl(_7, const 1_i32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
|
||||
assert(!move (_11.1: bool), "attempt to shift left by `{}`, which would overflow", const 1_i32) -> bb2; // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
|
||||
- _12 = BitAnd(const 1_i32, const -32_i32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
|
||||
- _13 = Ne(move _12, const 0_i32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
|
||||
- assert(!move _13, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> bb2; // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
|
||||
+ _12 = const 0_i32; // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
|
||||
+ _13 = const false; // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
|
||||
+ assert(!const false, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> bb2; // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_6 = move (_11.0: u32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
|
||||
_6 = Shl(move _7, const 1_i32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
|
||||
StorageDead(_7); // scope 0 at $DIR/issue_101973.rs:+1:56: +1:57
|
||||
_3 = rotate_right::<u32>(_4, _6) -> bb4; // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
|
||||
_3 = rotate_right::<u32>(_4, _6) -> bb3; // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
|
||||
// mir::Constant
|
||||
// + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
|
||||
// + literal: Const { ty: extern "rust-intrinsic" fn(u32, u32) -> u32 {rotate_right::<u32>}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb3: {
|
||||
_13 = move (_14.0: u32); // scope 2 at $DIR/issue_101973.rs:7:12: 7:20
|
||||
_12 = BitAnd(move _13, const 255_u32); // scope 2 at $DIR/issue_101973.rs:7:12: 7:27
|
||||
StorageDead(_13); // scope 2 at $DIR/issue_101973.rs:7:26: 7:27
|
||||
_4 = BitOr(const 0_u32, move _12); // scope 2 at $DIR/issue_101973.rs:7:5: 7:27
|
||||
StorageDead(_12); // scope 2 at $DIR/issue_101973.rs:7:26: 7:27
|
||||
StorageLive(_6); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
|
||||
StorageLive(_7); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:52
|
||||
StorageLive(_8); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
|
||||
_10 = CheckedShr(_1, const 8_i32); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
|
||||
assert(!move (_10.1: bool), "attempt to shift right by `{}`, which would overflow", const 8_i32) -> bb1; // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
|
||||
}
|
||||
|
||||
bb4: {
|
||||
StorageDead(_6); // scope 0 at $DIR/issue_101973.rs:+1:57: +1:58
|
||||
StorageDead(_4); // scope 0 at $DIR/issue_101973.rs:+1:57: +1:58
|
||||
_2 = move _3 as i32 (IntToInt); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:65
|
||||
|
|
|
|||
|
|
@ -39,19 +39,19 @@ error[E0080]: evaluation of constant value failed
|
|||
--> $DIR/offset_from_ub.rs:53:14
|
||||
|
|
||||
LL | unsafe { ptr_offset_from(end_ptr, start_ptr) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc18 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc17 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/offset_from_ub.rs:62:14
|
||||
|
|
||||
LL | unsafe { ptr_offset_from(start_ptr, end_ptr) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc21 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc20 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/offset_from_ub.rs:70:14
|
||||
|
|
||||
LL | unsafe { ptr_offset_from(end_ptr, end_ptr) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc24 has size 4, so pointer at offset 10 is out-of-bounds
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc23 has size 4, so pointer at offset 10 is out-of-bounds
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/offset_from_ub.rs:79:14
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue