https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82602
Bernd Edlinger <bernd.edlinger at hotmail dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bernd.edlinger at hotmail dot de --- Comment #5 from Bernd Edlinger <bernd.edlinger at hotmail dot de> --- (In reply to Xi Ruoyao from comment #3) > I'm still not convinced this is a bug. For example, all kernel code > uses `asm volatile ("" ::: "memory")` as barrier to stop GCC to reorder code > through it, not `asm volatile ("" :::)`. So the developers have been aware > a "asm volatile" does NOT mean a barrier. If we change this behaviour and > stop reordering through all "asm volatile"s, the generated code could be > slower. Yes, spin locks need to have a "memory" clobber. I agree it will only work by chance without.