The attached patch continues the improvements to out of bounds checking(*) by decorating more APIs with either attribute access, or by explicitly providing the array bound in APIs such as tmpnam() that expect arrays of some minimum size as arguments. (The latter feature is new in GCC 11.) The only effects of the attribute and/or the array bound is to check and diagnose calls to the functions that fail to provide a sufficient number of elements, and the definitions of the functions that access elements outside the specified bounds. (There is no interplay with _FORTIFY_SOURCE here yet.) For example, because the patch specifies the bound in the tmpnam declaration like so: extern char *tmpnam (char[L_tmpnam]) __THROW __wur; the following call to the function: char* warn_tmpnam (void) { char a[16]; return tmpnam (a); } triggers the warning below: t.c: In function ‘warn_tmpnam’: t.c:8:10: warning: ‘tmpnam’ accessing 20 bytes in a region of size 16 [-Wstringop-overflow=] 8 | return tmpnam (a); | ^~~~~~~~~~ t.c:8:10: note: referencing argument 1 of type ‘char *’ In file included from ../include/stdio.h:14, from test-access-warn.c:1: ../libio/stdio.h:187:14: note: in a call to function ‘tmpnam’ 187 | extern char *tmpnam (char[L_tmpnam]) __THROW __wur; | ^~~~~~ Unlike the [static N] notation, the plain array notation doesn't require the argument to be nonnull. Besides attribute access, the change adds attribute nonnull to the readv and writev functions in misc/sys/uio.h. The functions don't necessarily access the array elements when their count is zero but neither POSIX nor the Linux manual document this so it seems appropriate to warn. The patch introduces the _L_tmpnam macro to avoid polluting the POSIX namespace with L_tmpnam when the latter is only supposed to be defined in . This in turn causes the a number of POSIX conformance test failures that I haven't been able to figure how to deal with and need some help with. In file included from ../include/unistd.h:2, from /tmp/tmpzm39v4n3/test.c:1: ../posix/unistd.h:1159:32: error: ‘_L_ctermid’ undeclared here (not in a function) extern char *ctermid (char __s[_L_ctermid]) __THROW ^~~~~~~~~~ I expected adding the new macros to stdio-common/stdio_lim.h.in would do the trick but clearly something else is needed and I'm at a lost as to what that might be. I haven't been able to find my way out of the maze of scripts and makefiles that tie all this together. Thanks Martin [*] https://sourceware.org/pipermail/libc-alpha/2020-April/113503.html