[llvm-commits] [llvm] r67691 - /llvm/trunk/test/FrontendC/memcpy_chk.c

Evan Cheng evan.cheng at apple.com
Wed Mar 25 09:49:32 PDT 2009


Author: evancheng
Date: Wed Mar 25 11:49:31 2009
New Revision: 67691

URL: http://llvm.org/viewvc/llvm-project?rev=67691&view=rev
Log:
Add __builtin___memcpy_chk tests.

Added:
    llvm/trunk/test/FrontendC/memcpy_chk.c

Added: llvm/trunk/test/FrontendC/memcpy_chk.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/memcpy_chk.c?rev=67691&view=auto

==============================================================================
--- llvm/trunk/test/FrontendC/memcpy_chk.c (added)
+++ llvm/trunk/test/FrontendC/memcpy_chk.c Wed Mar 25 11:49:31 2009
@@ -0,0 +1,23 @@
+// RUN: %llvmgcc -S -emit-llvm -O1 %s -o - | grep call | grep memcpy_chk | count 3
+// RUN: %llvmgcc -S -emit-llvm -O1 %s -o - | grep call | grep {llvm.memcpy} | count 2
+
+void *t1(void *d, void *s) {
+  return __builtin___memcpy_chk(d, s, 16, 0);
+}
+
+void *t2(void *d, void *s) {
+  return __builtin___memcpy_chk(d, s, 16, 10);
+}
+
+void *t3(void *d, void *s) {
+  return __builtin___memcpy_chk(d, s, 16, 17);
+}
+
+void *t4(void *d, void *s, unsigned len) {
+  return __builtin___memcpy_chk(d, s, len, 17);
+}
+
+char buf[10];
+void *t5(void *s, unsigned len) {
+  return __builtin___memcpy_chk(buf, s, 5, __builtin_object_size(buf, 0));
+}





More information about the llvm-commits mailing list