On Wed, 29 Oct 2025, Qing Zhao wrote: > The attribute is allowed for a pointer to void, However, > Warnings will be issued for such cases when -Wpointer-arith is > specified. When this attribute is applied on a pointer to void, the > size of each element of this pointer array is treated as 1. > > gcc/c-family/ChangeLog: > > * c-attribs.cc (handle_counted_by_attribute): Allow counted_by for > void pointer. Issue warnings when -Wpointer-arith is present. > > gcc/c/ChangeLog: > > * c-typeck.cc (build_access_with_size_for_counted_by): When the element > type is void, assign size one as the element_size. > > gcc/ChangeLog: > > * doc/extend.texi: Clarification when the counted_by attribute is > applied > on a void pointer. > > gcc/testsuite/ChangeLog: > > * gcc.dg/pointer-counted-by.c: Update for void pointers. > * gcc.dg/pointer-counted-by-10.c: New test. > * gcc.dg/pointer-counted-by-4-void.c: New test.
OK. -- Joseph S. Myers [email protected]
