3 ms·
Specifically on memory ordering bugs though, philosophically speaking, are they actually bugs if the condition is impossible to hit on a given platform? From a
by xxpor 3y ago
Specifically on memory ordering bugs though, philosophically speaking, are they actually bugs if the condition is impossible to hit on a given platform?
From an OpenBSD perspective, I can see it being valuable to know that it means the code can be safely ported to any random arch that comes out in the future, but for more commercial software, I really can't see that being worth the time worrying about.
- nyanpasu64 3y agoI think compilers are free to reorder code at compile time assuming single-threaded execution, exposing the same bugs that memory ordering exposes at runtime. I'm not sure if MSVC does this or not.
- xxpor 3y agoThere are a lot of details, but essentially yes. To solve that, see the compiler barriers section in https://www.kernel.org/doc/Documentation/memory-barriers.txt https://www.kernel.org/doc/Documentation/memory-barriers.txt