Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 8215702

Browse files
committed
Refer to GitHub issue on overwritten init value
1 parent 4a07f78 commit 8215702

File tree

4 files changed

+3
-2
lines changed

4 files changed

+3
-2
lines changed

src/concurrency/data_race.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
544544
// side effects from a read the program did not perform. So we have to initialise
545545
// the store buffer with the value currently being written
546546
// ONCE this is fixed please remove the hack in buffered_atomic_write() in weak_memory.rs
547+
// https://github.com/rust-lang/miri/issues/2164
547548
this.buffered_atomic_write(val, dest, atomic, val)
548549
}
549550

src/concurrency/weak_memory.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ pub(super) trait EvalContextExt<'mir, 'tcx: 'mir>:
508508
// UGLY HACK: in write_scalar_atomic() we don't know the value before our write,
509509
// so init == val always. If the buffer is fresh then we would've duplicated an entry,
510510
// so we need to remove it.
511+
// See https://github.com/rust-lang/miri/issues/2164
511512
let was_empty = matches!(
512513
alloc_buffers
513514
.store_buffers

src/machine.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,6 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
638638
None
639639
};
640640
let buffer_alloc = if ecx.machine.weak_memory {
641-
// FIXME: if this is an atomic obejct, we want to supply its initial value
642-
// while allocating the store buffer here.
643641
Some(weak_memory::AllocExtra::new_allocation())
644642
} else {
645643
None

tests/compile-fail/weak_memory/cpp20_rwc_syncs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ fn reads_value(loc: &AtomicUsize, val: usize) -> usize {
2525
fn static_atomic(val: usize) -> &'static AtomicUsize {
2626
let ret = Box::leak(Box::new(AtomicUsize::new(val)));
2727
// A workaround to put the initialization value in the store buffer.
28+
// See https://github.com/rust-lang/miri/issues/2164
2829
ret.load(Relaxed);
2930
ret
3031
}

0 commit comments

Comments
 (0)