Refer to GitHub issue on overwritten init value
This commit is contained in:
parent
4a07f78dad
commit
8215702d5a
@ -544,6 +544,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
|
||||
// side effects from a read the program did not perform. So we have to initialise
|
||||
// the store buffer with the value currently being written
|
||||
// ONCE this is fixed please remove the hack in buffered_atomic_write() in weak_memory.rs
|
||||
// https://github.com/rust-lang/miri/issues/2164
|
||||
this.buffered_atomic_write(val, dest, atomic, val)
|
||||
}
|
||||
|
||||
|
@ -508,6 +508,7 @@ pub(super) trait EvalContextExt<'mir, 'tcx: 'mir>:
|
||||
// UGLY HACK: in write_scalar_atomic() we don't know the value before our write,
|
||||
// so init == val always. If the buffer is fresh then we would've duplicated an entry,
|
||||
// so we need to remove it.
|
||||
// See https://github.com/rust-lang/miri/issues/2164
|
||||
let was_empty = matches!(
|
||||
alloc_buffers
|
||||
.store_buffers
|
||||
|
@ -638,8 +638,6 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
|
||||
None
|
||||
};
|
||||
let buffer_alloc = if ecx.machine.weak_memory {
|
||||
// FIXME: if this is an atomic obejct, we want to supply its initial value
|
||||
// while allocating the store buffer here.
|
||||
Some(weak_memory::AllocExtra::new_allocation())
|
||||
} else {
|
||||
None
|
||||
|
@ -25,6 +25,7 @@ fn reads_value(loc: &AtomicUsize, val: usize) -> usize {
|
||||
fn static_atomic(val: usize) -> &'static AtomicUsize {
|
||||
let ret = Box::leak(Box::new(AtomicUsize::new(val)));
|
||||
// A workaround to put the initialization value in the store buffer.
|
||||
// See https://github.com/rust-lang/miri/issues/2164
|
||||
ret.load(Relaxed);
|
||||
ret
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user