Closed
Description
Currently Miri throws a UB on the access that ultimately causes a data race, which is always the later one. It is not clear where the other access involved in the data race is in the source file.
error: Undefined Behavior: Data race detected between Write on Thread(id = 0, name = "main") and Write on Thread(id = 1) at alloc1 (current vector clock = VClock([5]), conflicting timestamp = VClock([0, 8]))
--> src/lib.rs:21:18
|
21 | unsafe { V = 2 }
| ^^^^^ Data race detected between Write on Thread(id = 0, name = "main") and Write on Thread(id = 1) at alloc1 (current vector clock = VClock([5]), conflicting timestamp = VClock([0, 8]))
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: inside `tests::data_race` at src/lib.rs:21:18
Both TSan and Go's race detector print out the line numbers of both accesses involved in the data race, we'd like to do the same.
It shouldn't be too hard to implement, we just need to augment VTimestamp
with the current Span
from MiriEvalContext::cur_span()
Line 45 in aca3b3a