For memset (and others) we can get diagnostics like:
struct stat { int x; }; void foo(struct stat *stamps) { memset(stamps, 0, sizeof(stamps)); } t.c:7:28: warning: 'memset' call operates on objects of type 'struct stat' while the size is based on a different type 'struct stat *' [-Wsizeof-pointer-memaccess] memset(stamps, 0, sizeof(stamps)); ~~~~~~ ^~~~~~ t.c:7:28: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)? memset(stamps, 0, sizeof(stamps)); ^~~~~~
This patch adds support for the same class of warnings for bzero.