[PATCH] D62962: Clang implementation of sizeless types
Richard Sandiford via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 10 10:58:08 PDT 2019
rsandifo-arm marked 2 inline comments as done.
rsandifo-arm added inline comments.
================
Comment at: test/Sema/sizeless-1.c:66
+ _Static_assert(__atomic_always_lock_free(1, &local_int8) == __atomic_always_lock_free(1, incomplete_ptr), "");
+ _Static_assert(__atomic_always_lock_free(2, &local_int8) == __atomic_always_lock_free(2, incomplete_ptr), "");
+
----------------
jfb wrote:
> I expect sizeless types are never lock free.
Yeah, that's right. But AIUI `__atomic_always_lock_free(N, P)` asks whether an N-byte access at P is lock-free (where P can be null to query standard alignment). So the question isn't whether sizeless types are lock-free, but whether an N-byte access is lock-free given the alignment guarantees of P. For this line the answer would be yes if `&local_int8` was aligned to a 2-byte boundary.
The query isn't really that interesting for sizeless types. The reason for having it is that `IntExprEvaluator::VisitBuiltinCallExpr` says that 1-byte accesses are lock-free if the target has lock-free accesses, whatever P happens to be. But for larger N it punts when P is a pointer to incomplete type, because in that case it knows nothing about the alignment of P. The test is enforcing this behaviour for sizeless types too.
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62962/new/
https://reviews.llvm.org/D62962
More information about the cfe-commits
mailing list