summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/bstring.c
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-05-03 18:21:28 +0000
committerAnna Zaks <ganna@apple.com>2012-05-03 18:21:28 +0000
commitb3b56bb9600d5626b706cfb3d3b5cc365cafa4dd (patch)
treea41b9df38bf7631c5982e2a4db1e955f936437a2 /clang/test/Analysis/bstring.c
parent673e085a1ce3973bde2ac5d00dcd3cab3e37fbe7 (diff)
downloadbcm5719-llvm-b3b56bb9600d5626b706cfb3d3b5cc365cafa4dd.tar.gz
bcm5719-llvm-b3b56bb9600d5626b706cfb3d3b5cc365cafa4dd.zip
[analyzer] CString Checker: Do not split the path unless the user
specifically checks for equality to null. Enforcing this general practice, which keeps the analyzer less noisy, in the CString Checker. This change suppresses "Assigned value is garbage or undefined" warning in the added test case. llvm-svn: 156085
Diffstat (limited to 'clang/test/Analysis/bstring.c')
-rw-r--r--clang/test/Analysis/bstring.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/Analysis/bstring.c b/clang/test/Analysis/bstring.c
index 833c917613e..87c91613a5d 100644
--- a/clang/test/Analysis/bstring.c
+++ b/clang/test/Analysis/bstring.c
@@ -428,3 +428,13 @@ void bcopy2 () {
bcopy(src, dst, 4); // expected-warning{{overflow}}
}
+
+void *malloc(size_t);
+void free(void *);
+char radar_11125445_memcopythenlogfirstbyte(const char *input, size_t length) {
+ char *bytes = malloc(sizeof(char) * (length + 1));
+ memcpy(bytes, input, length);
+ char x = bytes[0]; // no warning
+ free(bytes);
+ return x;
+}
OpenPOWER on IntegriCloud