Skip to content

Commit c1b8256

Browse files
committed
weak memory outdated loads: show where the load was from
1 parent bafa392 commit c1b8256

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/concurrency/weak_memory.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,9 @@ pub(super) trait EvalContextExt<'mir, 'tcx: 'mir>:
520520
validate,
521521
)?;
522522
if global.track_outdated_loads && recency == LoadRecency::Outdated {
523-
this.emit_diagnostic(NonHaltingDiagnostic::WeakMemoryOutdatedLoad);
523+
this.emit_diagnostic(NonHaltingDiagnostic::WeakMemoryOutdatedLoad {
524+
ptr: place.ptr(),
525+
});
524526
}
525527

526528
return Ok(loaded);

src/diagnostics.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ pub enum NonHaltingDiagnostic {
125125
Int2Ptr {
126126
details: bool,
127127
},
128-
WeakMemoryOutdatedLoad,
128+
WeakMemoryOutdatedLoad {
129+
ptr: Pointer<Option<Provenance>>,
130+
},
129131
}
130132

131133
/// Level of Miri specific diagnostics
@@ -583,7 +585,8 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> {
583585
| AccessedAlloc(..)
584586
| FreedAlloc(..)
585587
| ProgressReport { .. }
586-
| WeakMemoryOutdatedLoad => ("tracking was triggered".to_string(), DiagLevel::Note),
588+
| WeakMemoryOutdatedLoad { .. } =>
589+
("tracking was triggered".to_string(), DiagLevel::Note),
587590
};
588591

589592
let msg = match &e {
@@ -610,8 +613,8 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> {
610613
ProgressReport { .. } =>
611614
format!("progress report: current operation being executed is here"),
612615
Int2Ptr { .. } => format!("integer-to-pointer cast"),
613-
WeakMemoryOutdatedLoad =>
614-
format!("weak memory emulation: outdated value returned from load"),
616+
WeakMemoryOutdatedLoad { ptr } =>
617+
format!("weak memory emulation: outdated value returned from load at {ptr}"),
615618
};
616619

617620
let notes = match &e {

0 commit comments

Comments
 (0)