See test. Judging from PR 1278, at the time the test was committed, the
[oota-llvm.git] / test / FrontendC / memcpy_chk.c
1 // RUN: %llvmgcc -S -emit-llvm -O1 %s -o - | grep call | grep memcpy_chk | count 3
2 // RUN: %llvmgcc -S -emit-llvm -O1 %s -o - | grep call | grep {llvm.memcpy} | count 3
3 // rdar://6716432
4
5 void *t1(void *d, void *s) {
6   return __builtin___memcpy_chk(d, s, 16, 0);
7 }
8
9 void *t2(void *d, void *s) {
10   return __builtin___memcpy_chk(d, s, 16, 10);
11 }
12
13 void *t3(void *d, void *s) {
14   return __builtin___memcpy_chk(d, s, 16, 17);
15 }
16
17 void *t4(void *d, void *s, unsigned len) {
18   return __builtin___memcpy_chk(d, s, len, 17);
19 }
20
21 char buf[10];
22 void *t5(void *s, unsigned len) {
23   return __builtin___memcpy_chk(buf, s, 5, __builtin_object_size(buf, 0));
24 }
25
26 void *t6(void *d, void *s) {
27   return __builtin___memcpy_chk(d, s, 16, __builtin_object_size(d, 0));
28 }