Does anyone know an example demonstrating that reasoning based on the hardware concurrency memory model when writing Rust does not work? Basically something like this but for concurrency and in Rust. ;)
I've been thinking maybe one could use
Relaxed where one should use
Acquire -- on x86 that compiles the same, so "what the hardware does" would work, but if we can get LLVM to reorder an access across the
Relaxed that it would not be allowed to reorder across the
Acquire, that would demonstrate that "what the hardware does" just does not matter.
Here's a program exhibitng UB this way, but I dont know how to make LLVM optimize it the bad way: https://play.rust-lang.org/?version=stable&mode=release&edition=2018&gist=11a26c7f5ba7c7777501f3b8040776f6