[cfe-commits] [patch] Warn on memset(p, 0, sizeof(p))
Nico Weber
thakis at chromium.org
Sun Jun 12 22:23:25 PDT 2011
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-memset.patch
Type: application/octet-stream
Size: 5446 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110612/ad49aced/attachment.obj>
More information about the cfe-commits
mailing list