diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-06-16 04:13:47 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-06-16 04:13:47 +0000 |
commit | 30f3210242c3291a4bc00ff22b46f58721e25923 (patch) | |
tree | 400c57be448a685e426a9d844376b6d975b71528 | |
parent | 72f4b851194f3dfb48847da7db92b81a7b7f3c31 (diff) | |
download | bcm5719-llvm-30f3210242c3291a4bc00ff22b46f58721e25923.tar.gz bcm5719-llvm-30f3210242c3291a4bc00ff22b46f58721e25923.zip |
Fix my test case from r133136 so that it actually represents the code
pattern found in the wild where this warning was firing.
llvm-svn: 133143
-rw-r--r-- | clang/test/SemaCXX/warn-memset-bad-sizeof.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp b/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp index 167f05f3daf..b334500ef5c 100644 --- a/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp +++ b/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp @@ -23,11 +23,10 @@ inline Dest bit_cast(const Source& source) { } // 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 @@ void f(Mat m, const Foo& const_foo) { 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)); |