Skip to content

Commit 6cada3e

Browse files
committed
chore: commit chagnes for rebase
1 parent ecf9336 commit 6cada3e

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

kmir/src/kmir/kdist/mir-semantics/rt/pointer-int.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,9 @@ module RT-POINTER-INT
297297
requires WIDTH >Int 0
298298
299299
syntax Int ::= #unsignedFromIntValue ( Int , Int , Bool ) [function, total]
300-
rule #unsignedFromIntValue(VAL, _WIDTH, false) => VAL
301-
rule #unsignedFromIntValue(VAL, _WIDTH, true) => VAL
300+
rule #unsignedFromIntValue(VAL, _WIDTH, _SIGNED) => VAL
302301
requires VAL >=Int 0
303-
rule #unsignedFromIntValue(VAL, WIDTH, true)
302+
rule #unsignedFromIntValue(VAL, WIDTH, _SIGNED)
304303
=> VAL +Int (1 <<Int WIDTH)
305304
requires VAL <Int 0
306305
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
use std::cell::UnsafeCell;
21
use std::mem::transmute;
32

43
fn main() {
5-
let cell = UnsafeCell::new(0_u8);
6-
let ptr = cell.get();
4+
let mut byte = 0_u8;
5+
let ptr = &mut byte as *mut u8;
76

8-
// Model code that leaks a raw pointer address to user space.
7+
// Leak the raw pointer address as an integer.
98
let leaked_addr = unsafe { transmute::<*mut u8, usize>(ptr) };
109

11-
// …and then turns the address back into a pointer, assuming round-trip soundness.
10+
// Turn it back into a pointer, assuming round-trip soundness.
1211
let restored_ptr = unsafe { transmute::<usize, *mut u8>(leaked_addr) };
1312

14-
// assert_eq!(ptr, restored_ptr);
13+
assert_eq!(ptr, restored_ptr);
1514
}

0 commit comments

Comments
 (0)