https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120520
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
Last reconfirmed| |2025-06-03
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
For strncat/wcsncat we don't need to do anything, the builtins are already
handled correctly and nonnull_if_nonzero attribute can be used in libc for it.
For fread/fwrite, we IMHO need a 3 argument variant of nonnull_if_nonzero
attribute, because the wording is
"If size or nmemb is zero, ptr may be a null pointer"
and so we need to check for nonnull only if 2 integral arguments are both known
not to be zero.
Plus fwrite/fwrite_unlocked have a builtin (fread/fread_unlocked don't).