adjust code for copy_op changes

This commit is contained in:
Ralf Jung 2022-07-02 21:17:35 -04:00
parent e9176c747e
commit 5fed3ebc26
3 changed files with 4 additions and 3 deletions

View file

@ -169,7 +169,7 @@ impl Provenance for Tag {
write!(f, "{:?}", sb)?;
}
Tag::Wildcard => {
write!(f, "[Wildcard]")?;
write!(f, "[wildcard]")?;
}
}

View file

@ -68,12 +68,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
"volatile_load" => {
let [place] = check_arg_count(args)?;
let place = this.deref_operand(place)?;
this.copy_op(&place.into(), dest)?;
this.copy_op(&place.into(), dest, /*allow_transmute*/ false)?;
}
"volatile_store" => {
let [place, dest] = check_arg_count(args)?;
let place = this.deref_operand(place)?;
this.copy_op(dest, &place.into())?;
this.copy_op(dest, &place.into(), /*allow_transmute*/ false)?;
}
"write_bytes" | "volatile_set_memory" => {

View file

@ -3,6 +3,7 @@
fn main() {
// If we are careful, we can exploit data layout...
// This is a tricky case since we are transmuting a ScalarPair type to a non-ScalarPair type.
let raw = unsafe { std::mem::transmute::<&[u8], [*const u8; 2]>(&[42]) };
let ptr: *const u8 = unsafe { std::mem::transmute_copy(&raw) };
assert_eq!(unsafe { *ptr }, 42);