Hi,

the attached patch produces this diagnostic

  test.cpp:16:17: warning: The sizeof expression in 'memset' has type
'S *', the same type that the first argument has. The sizeof
expression should probably have type 'S' instead.

for this code:

  struct S {};
  S* ps;
  memset(ps, 0, sizeof(ps));  // Should be sizeof(*ps)

This is PR9977.

Ok?

I've built llvm, clang, and parts of chrome with this patch.
llvm/clang build fine; in chrome I found at least one error with this
already. (chrome doesn't build cleanly with ToT clang at the moment
for other reasons, so I can't do a full evaluation at the moment.)

Nico

Attachment: clang-memset.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to