[cfe-commits] r133143 - /cfe/trunk/test/SemaCXX/warn-memset-bad-sizeof.cpp
Chandler Carruth
chandlerc at gmail.com
Wed Jun 15 21:13:47 PDT 2011
Author: chandlerc
Date: Wed Jun 15 23:13:47 2011
New Revision: 133143
URL: http://llvm.org/viewvc/llvm-project?rev=133143&view=rev
Log:
Fix my test case from r133136 so that it actually represents the code
pattern found in the wild where this warning was firing.
Modified:
cfe/trunk/test/SemaCXX/warn-memset-bad-sizeof.cpp
Modified: cfe/trunk/test/SemaCXX/warn-memset-bad-sizeof.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-memset-bad-sizeof.cpp?rev=133143&r1=133142&r2=133143&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-memset-bad-sizeof.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-memset-bad-sizeof.cpp Wed Jun 15 23:13:47 2011
@@ -23,11 +23,10 @@
}
// http://www.lysator.liu.se/c/c-faq/c-2.html#2-6
-void f(Mat m, const Foo& const_foo) {
+void f(Mat m, const Foo& const_foo, char *buffer) {
S s;
S* ps = &s;
PS ps2 = &s;
- char c = 42;
char arr[5];
char* parr[5];
Foo foo;
@@ -68,8 +67,9 @@
memcpy(&foo, &const_foo, sizeof(Foo));
memcpy((void*)&s, 0, sizeof(&s));
memcpy(0, (void*)&s, sizeof(&s));
- memcpy(&parr[3], &c, sizeof(&c));
- memcpy((char*)&parr[3], &c, sizeof(&c));
+ char *cptr;
+ memcpy(&cptr, buffer, sizeof(cptr));
+ memcpy((char*)&cptr, buffer, sizeof(cptr));
CFooRef cfoo = foo;
memcpy(&foo, &cfoo, sizeof(Foo));
More information about the cfe-commits
mailing list