On Wed, 10 Sept 2025, 07:23 Florian Weimer via Gcc, <gcc@gcc.gnu.org> wrote:
> * Chris Packham via Gcc: > > > Is there any attribute I can set on the memset like functions that will > let > > gcc know to perform the same kinds of checks as the standard memset > > function? > > There's the “access” function attribute. It covers at least some > aspects. > If you pass sizeof(ptr) as the size then the compiler won't warn if it doesn't know the size of the buffer that ptr points to, nor will it warn if it can see that ptr points to a buffer of at least sizeof(ptr) bytes.