[clang] [Clang] Add __builtin_counted_by_ref builtin (PR #114495)
Yeoul Na via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 4 15:47:48 PST 2024
================
@@ -16,6 +16,8 @@ void test1(struct fam_struct *ptr, int size, int idx) {
*__builtin_counted_by_ref(ptr->array) = size; // ok
*__builtin_counted_by_ref(&ptr->array[idx]) = size; // ok
+ *__builtin_counted_by_ref(&ptr->array) = size; // ok
----------------
rapidsna wrote:
I guess this will just work too? `*__builtin_counted_by_ref(ptr->array[idx]) = size;`
Do you have a use case? I'd prefer these being ill-formed because the user might find it working unexpectedly. But I don't have a strong opinion on this. I'd leave it up to you/Linux users if you find this would be useful.
https://github.com/llvm/llvm-project/pull/114495
More information about the cfe-commits
mailing list