It still references memcpy in -Wsizeof-pointer-memaccess section.  Let me
suggest instead:

    To fix, properly pass the size of cleared memory as the last argument:
    either dereference the pointer argument to sizeof when clearing *one
    pointed-to element*, or in addition to that multiply sizeof(*p) by the
    number of elements to clear in the pointed-to array (which may not be
    known at the point of memset call without additional code changes).



I suppose a good chunk of problematic code hitting this warning would be doing
something like:

    void foo(int a[])
    {
      memset(a, 0, sizeof(a));
    }

... in which case dereferencing a in sizeof is probably the wrong thing to do.


Alexander

Reply via email to