================
@@ -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
----------------
bwendling wrote:

Note that, because GCC only checks if the argument is an array, it allows for 
things like:

```c
int global_array[];

void foo(int val) {
  *__builtin_counted_by_ref(global_array) = val;
}
```

which isn't great.

https://github.com/llvm/llvm-project/pull/114495
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to