struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-memcpy-bi.c
blobfaeda7d64849a44fa6ebfd0302cb43118a002d4b
1 /*
2 memcpy-bi.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma disable_warning 85
9 #endif
11 #if !(defined(__SDCC_mcs51) && defined(__SDCC_MODEL_SMALL)) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
12 /* Test builtin-memcpy (which may emit different code for different N). */
13 #include <string.h>
15 #define TESTSIZE 80
17 char src[TESTSIZE];
18 char dst[TESTSIZE];
20 void
21 check (char *test, char *match, int n)
23 if (memcmp (test, match, n))
24 ASSERT (0);
27 #define TN(n) \
28 { memset (dst, 0, n); memcpy (dst, src, n); check (dst, src, n); }
29 #define T(n) \
30 TN (n) \
31 TN ((n) + 1) \
32 TN ((n) + 2) \
33 TN ((n) + 3)
34 #endif
36 void
37 testTortureExecute (void)
39 #if !(defined(__SDCC_mcs51) && defined(__SDCC_MODEL_SMALL)) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
40 int i,j;
42 for (i = 0; i < sizeof (src); ++i)
43 src[i] = 'a' + i % 26;
45 T (0);
46 T (4);
47 T (8);
48 T (12);
49 T (16);
50 T (20);
51 T (24);
52 T (28);
53 T (32);
54 T (36);
55 T (40);
56 T (44);
57 T (48);
58 T (52);
59 T (56);
60 T (60);
61 T (64);
62 T (68);
63 T (72);
64 T (76);
65 #endif
66 return;