This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Implementing atomic load as compare-and-swap for read-only memory


Hi all,

expand_atomic_load in optabs.c tries to expand a wide atomic load using an atomic_compare_and_swap
with the comment saying that sometimes a redundant harmless store may be performed.
Is the store really valid if the memory is read-only?

I've been looking at implementing a similar compare-and-swap strategy for atomic_loaddi for some
arm targets and this concern came up. I don't think GCC can statically prove that a particular
piece of memory is guaranteed to be writeable at runtime in all cases, so emitting a spurious
store would not be always valid.

I see this concern was already raised in https://gcc.gnu.org/ml/gcc-patches/2011-11/msg00278.html
but that doesn't seem to have gone anywhere.

Any thoughts? Should we remove the assumption that atomic loads always access writeable memory?

Thanks,
Kyrill


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]