From c288c3bf1a1954a8534c48b5afa44472b0fc3b65 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Wed, 25 Mar 2009 16:49:31 +0000 Subject: [PATCH] Add __builtin___memcpy_chk tests. llvm-svn: 67691 --- test/FrontendC/memcpy_chk.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/FrontendC/memcpy_chk.c diff --git a/test/FrontendC/memcpy_chk.c b/test/FrontendC/memcpy_chk.c new file mode 100644 index 00000000000..b6d01ec5642 --- /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)); +}