[PATCH] D51084: Implement -Watomic-implicit-seq-cst
JF Bastien via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 29 09:36:42 PDT 2018
jfb added a comment.
In https://reviews.llvm.org/D51084#1216913, @rjmccall wrote:
> It says the type of the assignment expression, not the type of the LHS.
>
> C11 [6.5.16]p2: "The type of an assignment expression is the type the left operand would have after lvalue conversion."
>
> C11 [6.3.2.1]p2: "...this is called lvalue conversion. If the lvalue has qualified type, the value has the unqualified version of the type of the lvalue; additionally, if the lvalue has atomic type, the value has the non-atomic version of the type of the lvalue; otherwise, the value has the type of the lvalue."
>
> The RHS is not converted to have atomic type.
Right that would be nonsensical because you'd need to load it atomically. The C `_Atomic` semantics match what C++ `std::atomic` does:
_Atomic(int) atom;
void ass(int i) {
atom = i;
}
is the same as:
#include <atomic>
std::atomic<int> atom;
void ass(int i) {
atom = i;
}
They're meant to be interchangeable.
This warning is meant to warn on C's implicit `seq_cst`. When I get to writing the C++ version of the warning I'll warn about C++'s implicit `seq_cst`.
Repository:
rC Clang
https://reviews.llvm.org/D51084
More information about the cfe-commits
mailing list