-
Notifications
You must be signed in to change notification settings - Fork 15.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clang generates atomic memory ordering warnings when compiling atomicops_internals_generic_gcc.h #25
Milestone
Comments
Could you help make a patch and remove these two methods? I don't think we are using them in protobuf. |
Sure, that's easier than any of the other options :-) |
Actually, I just looked at the TSAN atomics implementation, and it uses a full Changing the generic atomics to match that would be trivial. |
yordis
pushed a commit
to yordis/protobuf
that referenced
this issue
Dec 8, 2024
…oto-timestamp Add Google Protobuf Timestamp type
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
When protobuf is patched to expose the generic atomicops implementation on Clang as in PR #21, the following warnings are generated:
According to the gcc documentation at https://gcc.gnu.org/onlinedocs/gcc-4.9.1/gcc/_005f_005fatomic-Builtins.html, these arguments are indeed invalid.
__atomic_store_n()
cannot be passed__ATOMIC_ACQUIRE
and__atomic_load_n()
cannot be passed__ATOMIC_RELEASE
.I asked about this on IRC and got the following response from someone knowledgeable about atomic memory ordering.
"release + load (what the function name indicates) usually isn't a very interesting combination of behaviours."
"I doubt it has many users in protobuf?"
"if you want to get rid of the warnings you can probably add a explicit
__atomic_thread_fence(__ATOMIC_RELEASE)
and use__ATOMIC_RELAXED
in the actually intended atomic.""Alternatively just promote them to
SEQ_CST
;)"Indeed, a
git grep
of the protobuf repository shows that there aren't actually any users of theAcquire_Store()
andRelease_Load()
functions.The text was updated successfully, but these errors were encountered: