Hi, This is the 5th version of the patch set to extend "counted_by" attribute to pointer fields of structures.
compared to the 4rd version: https://gcc.gnu.org/pipermail/gcc-patches/2025-May/683538.html https://gcc.gnu.org/pipermail/gcc-patches/2025-May/683539.html https://gcc.gnu.org/pipermail/gcc-patches/2025-May/683540.html https://gcc.gnu.org/pipermail/gcc-patches/2025-May/683541.html The major change are updates per Joseph's comments: 1. counted_by is not allowed for a pointer to function; 2. counted_by is not allowed for a pointer to structure/union with FAM; 3. counted_by is allowed for a pointer to non-void incomplete structure or union type, as long as the type could be completed before the first reference to the pointer in the source code. 4. update documentation and testing case per the above 1,2,3; This patch set includes 3 parts: 1.Extend "counted_by" attribute to pointer fields of structures. 2.Convert a pointer reference with counted_by attribute to .ACCESS_WITH_SIZE and use it in builtinin-object-size. 3.Use the counted_by attribute of pointers in array bound checker. All the updates in this version are in patch 1. Patch 2 and 3 have no changes. The whole patch set has been rebased on the latest trunk, bootstrapped and regression tested on both aarch64 and x86. Okay for trunk? Thanks a lot. Qing