Skip to content
Snippets Groups Projects
Commit a5f08ad4 authored by Emil Kitti's avatar Emil Kitti
Browse files

bare0_5

parent e07aefa0
No related branches found
No related tags found
No related merge requests found
......@@ -18,17 +18,29 @@ static mut Y: u32 = 0;
#[inline(never)]
fn main() {
let mut x = unsafe { X };
let mut x = read_x();
loop {
x = x.wrapping_add(1);
write_x(read_x().wrapping_add(1));
write_y(read_x());
}
}
fn write_y(y: u32) {
unsafe {
X = X.wrapping_add(1);
Y = X;
assert!(x == X && X == Y + 1);
Y = y;
}
}
fn read_x() -> u32 {
unsafe { X }
}
fn write_x(x: u32) {
unsafe {
X = x;
}
}
// 1. run the program in the debugger,
// let the program run for a while and then press pause
// look in the (Local -vscode) Variables view what do you find
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment