[LLVMbugs] [Bug 19679] New: Warn when the return value of memcpy is compared to
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed May 7 10:21:05 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=19679
Bug ID: 19679
Summary: Warn when the return value of memcpy is compared to 0
Product: clang
Version: 3.4
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: ju.orth at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Consider this code:
```
#include <string.h>
int f(char *a);
int f(char *a)
{
return memcpy(a, "test", 4) != 0;
}
```
It is clear that this memcpy should actually be memcmp. The comparison makes no
sense and should cause clang to emit a warning.
--
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/20140507/6f5d01be/attachment.html>
More information about the llvm-bugs
mailing list