https://bugs.llvm.org/show_bug.cgi?id=36242
Bug ID: 36242
Summary: memset(foo,sizeof(foo),0) should warn
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangb...@nondot.org
Reporter: felix-l...@fefe.de
CC: llvm-bugs@lists.llvm.org
Consider this code:
#include <string.h>
int main() {
char buf[100];
memset(buf,sizeof(buf),0);
}
gcc -Wall will warn about this:
t.c: In function ‘main’:
t.c:6:3: warning: ‘memset’ used with constant zero length parameter; this could
be due to transposed parameters [-Wmemset-transposed-args]
memset(buf,sizeof(buf),0);
^~~~~~
I think clang should warn about this, too.
I tried clang 5.0.1 and 7.0.0 (trunk 323933) with -Weverything and got no
warning.
It could be argued that this belongs in the static analyzer, but even with
scan-build I get no warnings about this.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs