Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/memcpy-bi.c

raw
1 /* Test builtin-memcpy (which may emit different code for different N). */
2 #include <string.h>
3
4 void abort (void);
5
6 #define TESTSIZE 80
7
8 char src[TESTSIZE] __attribute__ ((aligned));
9 char dst[TESTSIZE] __attribute__ ((aligned));
10
11 void
12 check (char *test, char *match, int n)
13 {
14 if (memcmp (test, match, n))
15 abort ();
16 }
17
18 #define TN(n) \
19 { memset (dst, 0, n); memcpy (dst, src, n); check (dst, src, n); }
20 #define T(n) \
21 TN (n) \
22 TN ((n) + 1) \
23 TN ((n) + 2) \
24 TN ((n) + 3)
25
26 int
27 main (void)
28 {
29 int i,j;
30
31 for (i = 0; i < sizeof (src); ++i)
32 src[i] = 'a' + i % 26;
33
34 T (0);
35 T (4);
36 T (8);
37 T (12);
38 T (16);
39 T (20);
40 T (24);
41 T (28);
42 T (32);
43 T (36);
44 T (40);
45 T (44);
46 T (48);
47 T (52);
48 T (56);
49 T (60);
50 T (64);
51 T (68);
52 T (72);
53 T (76);
54
55 return 0;
56 }