miri: check that assignments do not self-overlap
This commit is contained in:
parent
1a449dcfd2
commit
7a83ef82da
3 changed files with 49 additions and 1 deletions
|
@ -700,8 +700,13 @@ where
|
|||
assert_eq!(src.layout.size, dest.layout.size);
|
||||
}
|
||||
|
||||
// Setting `nonoverlapping` here only has an effect when we don't hit the fast-path above,
|
||||
// but that should at least match what LLVM does where `memcpy` is also only used when the
|
||||
// type does not have Scalar/ScalarPair layout.
|
||||
// (Or as the `Assign` docs put it, assignments "not producing primitives" must be
|
||||
// non-overlapping.)
|
||||
self.mem_copy(
|
||||
src.ptr, src.align, dest.ptr, dest.align, dest_size, /*nonoverlapping*/ false,
|
||||
src.ptr, src.align, dest.ptr, dest.align, dest_size, /*nonoverlapping*/ true,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue