I'm really wondering why this is being considered.

A documented property of the form "GCC will use a single instruction
to do X when possible" means exactly nothing.  In particular, to call
such a statement a "guarantee" is seriously misleading.

If Linux needs the single-instruction property for atomicity, and it
thinks it can rely on this supposed property, then Linux has a bug.
To do atomic operations, you have to use primitives that are
guaranteed always to have the necessary atomicity properties.
Typically those would be found in asm statements.

I suspect it would be valuable to have standardized primitives for
atomic actions (semaphores, spinlocks, test-and-set primitives,
circular buffers, pick one).  But GCC's load/store semantics are not
those primitives, with or without a documented "single instruction
when possible" property.  

   paul


Reply via email to