aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-03-25 16:49:31 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-03-25 16:49:31 +0000
commitea4753e3700d16e7ae35afd533faba0ec564c566 (patch)
tree18382a8136be42842803828c07f760defadb34a5
parent1a9d5ccf1efe9949bdcc57401e3c9d2ba166e5fb (diff)
Add __builtin___memcpy_chk tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67691 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/FrontendC/memcpy_chk.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/FrontendC/memcpy_chk.c b/test/FrontendC/memcpy_chk.c
new file mode 100644
index 0000000000..b6d01ec564
--- /dev/null
+++ b/test/FrontendC/memcpy_chk.c
@@ -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));
+}