Skip to content
Snippets Groups Projects
Commit da193fc7 authored by Anton Grahn's avatar Anton Grahn
Browse files

bare0_5

parent 54dc13eb
No related branches found
No related tags found
No related merge requests found
......@@ -33,17 +33,33 @@ const X_INIT: u32 = core::u32::MAX;
static mut X: u32 = X_INIT;
static mut Y: u32 = 0;
fn read_x()->u32{
unsafe{X}
}
fn read_y()->u32{
unsafe{Y}
}
fn write_y(y:u32){
unsafe{Y=y};
}
fn write_x(x:u32){
unsafe{X=x};
}
#[entry]
fn main() -> ! {
// local mutable variable (changed in safe code)
let mut x = unsafe { X };
let mut x = read_x();
loop {
x = x.wrapping_add(1); // <- place breakpoint here (3)
unsafe {
X = X.wrapping_add(1);
Y = X;
assert!(x == X && X == Y+1);
}
write_x(read_x().wrapping_add(1));
write_y(read_x());
assert!(x == read_x() && read_x() == read_y()+1);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment