miri native_calls: ensure we actually expose *mutable* provenance to the memory FFI can access
This commit is contained in:
parent
705421b522
commit
3846f94230
4 changed files with 12 additions and 3 deletions
|
@ -982,6 +982,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
|||
todo.push(id);
|
||||
}
|
||||
}
|
||||
// Also expose the provenance of the interpreter-level allocation, so it can
|
||||
// be read by FFI. The `black_box` is defensive programming as LLVM likes
|
||||
// to (incorrectly) optimize away ptr2int casts whose result is unused.
|
||||
std::hint::black_box(alloc.get_bytes_unchecked_raw().expose_provenance());
|
||||
|
||||
// Prepare for possible write from native code if mutable.
|
||||
if info.mutbl.is_mut() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue