[llvm-bugs] [Bug 38098] New: clang-tidy suspicious-memset-usage does not warn about `memset(dest, fill_value, 0)`
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Jul 8 23:44:29 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=38098
Bug ID: 38098
Summary: clang-tidy suspicious-memset-usage does not warn about
`memset(dest, fill_value, 0)`
Product: new-bugs
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: cpeterson at mozilla.com
CC: llvm-bugs at lists.llvm.org
clang-tidy's "bugprone-suspicious-memset-usage" check warns about `memset(dest,
sizeof(int), 0)` but does not warn for `memset(dest, 8, 0)` because the
statement does not include sizeof().
#include <string.h>
void test(int *dest)
{
memset(dest, sizeof(int), 0); // WARNING as expected
memset(dest, 8, 0); // NO WARNING even with hard-coded zero length?!
}
clang-tidy --checks="-*,bugprone-suspicious-memset-usage"
suspicious-memset-usage.cpp
https://clang.llvm.org/extra/clang-tidy/checks/bugprone-suspicious-memset-usage.html
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180709/8f833e4b/attachment.html>
More information about the llvm-bugs
mailing list