News for hackers. Stuff that matters.
Re:Nine ways to break your systems code using volatile by gpderetta on Friday October 06, 2023 @08:57AM (#37790178)
The compiler won't emit memory barriers for pthread_mutex_lock. It only need to make sure that all globally observable (i.e whose address has escaped)values are flushed from registers into memory. In practice this means that opaque function calls act as compiler memory barriers. Any additional required hardware memory barrier instruction is inside the implementation of pthread_mutex_lock itself.
Re:Nine ways to break your systems code using volatile by jstimpfle on Friday October 06, 2023 @12:16PM (#37792720)
Yes. I can see how setjmp()/longjmp() would need additional/special treatment by escape analysis. Now I'm only wondering why the problem would be limited to (syntactically) automatic local variables. If the control flow (returns twice etc) is surprising to the compiler, couldn't that affect optimizations to non-local variables too?
Re:Nine ways to break your systems code using volatile by kazinator on Friday October 06, 2023 @07:32PM (#37797664)
[delayed]