Skip to content

Commit

Permalink
adjust code for copy_op changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jul 3, 2022
1 parent 3f63926 commit 7e3e73b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl Provenance for Tag {
write!(f, "{:?}", sb)?;
}
Tag::Wildcard => {
write!(f, "[Wildcard]")?;
write!(f, "[wildcard]")?;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/shims/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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" => {
Expand Down
1 change: 1 addition & 0 deletions tests/pass/transmute_fat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7e3e73b

Please sign in to comment.