This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Fw: GCC interpretation of C11 atomics (DR 459)
> 1) your proposal would make gcc non-conforming to iso c unless it changes how static const objects are emitted.
I do not think, ISO C requires to put const objects to .rodata. And it is easily solved by not placing it there for _Atomic objects that cannot be safely loaded from read-only memory.
> 2) the two implementations are not abi compatible, the choice is already made, changing it is an abi break.
Since current implementations redirects to libatomic anyway, almost nothing should break. The only case it will break -- if somebody erroneously used atomic_load for 128-bit type on read-only memory (which is, again, not guaranteed by the standard). In practice, this case almost non-existent. The worst that may happen -- you will a segfault right away.
> 3) Torvald pointed out further considerations such as users expecting lock-free atomic loads to be faster than stores.
Is it even true? Is it faster to use some global lock (implemented through RMW) than a single RMW operation? If you use this global lock, you will not get loads faster than stores.