jfb 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), "");
+
----------------
rsandifo-arm wrote:
> 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.
Ah yes, that makes sense. Thanks!


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62962/new/

https://reviews.llvm.org/D62962



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to