Re: [WIP 0/3] Memory model and atomic API in Rust

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Mar 24, 2024, at 11:22 AM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> 
> I don't know if this is what you meant by "in a weak memory model, the 
> escape can ‘time travel'".  Regardless, it seems very clear that any 
> compiler which swaps L1 and L2 in f() has a genuine bug.

Yes, that’s what I meant.  Clang thinks it’s valid to swap L1 and L2.  Though, for it to actually happen, they would have to be in a loop, since the problematic optimization is “loop-invariant code motion".  Here’s a modified version of your f() that shows the optimization in action:

https://godbolt.org/z/bdaTjjvMs

Anyway, my point is just that using LKMM doesn’t save you from the bug.




[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux