diff options
| author | Ralf Jung <post@ralfj.de> | 2024-04-23 08:42:52 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-04-25 09:51:15 +0200 |
| commit | f38dba69b18a8ce593272ea3c2369c4274d8837b (patch) | |
| tree | 52a5dd60c58a1e260404198b5f22dc179f5a2ea1 | |
| parent | 9d7a47fe31c049d32989ee41efec61b57ea1a4e0 (diff) | |
| download | rust-f38dba69b18a8ce593272ea3c2369c4274d8837b.tar.gz rust-f38dba69b18a8ce593272ea3c2369c4274d8837b.zip | |
weak memory outdated loads: show where the load was from
| -rw-r--r-- | src/tools/miri/src/concurrency/weak_memory.rs | 4 | ||||
| -rw-r--r-- | src/tools/miri/src/diagnostics.rs | 11 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/tools/miri/src/concurrency/weak_memory.rs b/src/tools/miri/src/concurrency/weak_memory.rs index f544393cfe6..574962c48d4 100644 --- a/src/tools/miri/src/concurrency/weak_memory.rs +++ b/src/tools/miri/src/concurrency/weak_memory.rs @@ -520,7 +520,9 @@ pub(super) trait EvalContextExt<'mir, 'tcx: 'mir>: validate, )?; if global.track_outdated_loads && recency == LoadRecency::Outdated { - this.emit_diagnostic(NonHaltingDiagnostic::WeakMemoryOutdatedLoad); + this.emit_diagnostic(NonHaltingDiagnostic::WeakMemoryOutdatedLoad { + ptr: place.ptr(), + }); } return Ok(loaded); diff --git a/src/tools/miri/src/diagnostics.rs b/src/tools/miri/src/diagnostics.rs index 0c0ac4c6036..9fa786332e3 100644 --- a/src/tools/miri/src/diagnostics.rs +++ b/src/tools/miri/src/diagnostics.rs @@ -125,7 +125,9 @@ pub enum NonHaltingDiagnostic { Int2Ptr { details: bool, }, - WeakMemoryOutdatedLoad, + WeakMemoryOutdatedLoad { + ptr: Pointer<Option<Provenance>>, + }, } /// Level of Miri specific diagnostics @@ -583,7 +585,8 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> { | AccessedAlloc(..) | FreedAlloc(..) | ProgressReport { .. } - | WeakMemoryOutdatedLoad => ("tracking was triggered".to_string(), DiagLevel::Note), + | WeakMemoryOutdatedLoad { .. } => + ("tracking was triggered".to_string(), DiagLevel::Note), }; let msg = match &e { @@ -610,8 +613,8 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> { ProgressReport { .. } => format!("progress report: current operation being executed is here"), Int2Ptr { .. } => format!("integer-to-pointer cast"), - WeakMemoryOutdatedLoad => - format!("weak memory emulation: outdated value returned from load"), + WeakMemoryOutdatedLoad { ptr } => + format!("weak memory emulation: outdated value returned from load at {ptr}"), }; let notes = match &e { |
