Skip to content

Commit

Permalink
Add tests for read_volatile and write_volatile
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Feb 19, 2016
1 parent 7ae4ee8 commit 3b67e46
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/test/run-make/volatile-intrinsics/main.rs
Expand Up @@ -8,14 +8,20 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(core_intrinsics)]
#![feature(core_intrinsics, volatile)]

use std::intrinsics::{volatile_load, volatile_store};
use std::ptr::{read_volatile, write_volatile};

pub fn main() {
unsafe {
let mut i : isize = 1;
volatile_store(&mut i, 2);
assert_eq!(volatile_load(&i), 2);
}
unsafe {
let mut i : isize = 1;
write_volatile(&mut i, 2);
assert_eq!(read_volatile(&i), 2);
}
}

0 comments on commit 3b67e46

Please sign in to comment.