By: EduardoS (no.delete@this.spam.com), July 12, 2015 5:47 pm
Room: Moderated Discussions
Linus Torvalds (torvalds.delete@this.linux-foundation.org) on July 12, 2015 1:38 pm wrote:
> I seriously believe that the C standards committee is doing the wrong thing. They've done it for a long
> time. Re-ordering memory accesses by the compiler is not valid. Doing speculative writes to memory
> locations is not valid. It really should be that simple. Sure, the compiler can reorder things that
> it can prove are not semantically visible, but that's the only reordering the compiler should do.
Good argument, everyone life's would be easier if a variable read means "get the absolutely most up-to-date value of this memory location", but if it was the case x86 memory ordering would also be broken too and needs a lot of barriers.
> I seriously believe that the C standards committee is doing the wrong thing. They've done it for a long
> time. Re-ordering memory accesses by the compiler is not valid. Doing speculative writes to memory
> locations is not valid. It really should be that simple. Sure, the compiler can reorder things that
> it can prove are not semantically visible, but that's the only reordering the compiler should do.
Good argument, everyone life's would be easier if a variable read means "get the absolutely most up-to-date value of this memory location", but if it was the case x86 memory ordering would also be broken too and needs a lot of barriers.