aarch64: Add DLL import/export to AArch64 target
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / memcpy-1.c
blob3d9e92cdf564ad70034cf1d5cf68956c40ec9528
1 /* { dg-add-options stack_size } */
3 #include <string.h>
5 void abort (void);
6 void exit (int);
8 #if defined (STACK_SIZE)
9 #define MEMCPY_SIZE (STACK_SIZE / 3)
10 #else
11 #define MEMCPY_SIZE (1 << 17)
12 #endif
15 void *copy (void *o, const void *i, unsigned l)
17 return memcpy (o, i, l);
20 int
21 main (void)
23 unsigned i;
24 unsigned char src[MEMCPY_SIZE];
25 unsigned char dst[MEMCPY_SIZE];
27 for (i = 0; i < MEMCPY_SIZE; i++)
28 src[i] = (unsigned char) i, dst[i] = 0;
30 (void) memcpy (dst, src, MEMCPY_SIZE / 128);
32 for (i = 0; i < MEMCPY_SIZE / 128; i++)
33 if (dst[i] != (unsigned char) i)
34 abort ();
36 (void) memset (dst, 1, MEMCPY_SIZE / 128);
38 for (i = 0; i < MEMCPY_SIZE / 128; i++)
39 if (dst[i] != 1)
40 abort ();
42 (void) memcpy (dst, src, MEMCPY_SIZE);
44 for (i = 0; i < MEMCPY_SIZE; i++)
45 if (dst[i] != (unsigned char) i)
46 abort ();
48 (void) memset (dst, 0, MEMCPY_SIZE);
50 for (i = 0; i < MEMCPY_SIZE; i++)
51 if (dst[i] != 0)
52 abort ();
54 (void) copy (dst, src, MEMCPY_SIZE / 128);
56 for (i = 0; i < MEMCPY_SIZE / 128; i++)
57 if (dst[i] != (unsigned char) i)
58 abort ();
60 (void) memset (dst, 0, MEMCPY_SIZE);
62 (void) copy (dst, src, MEMCPY_SIZE);
64 for (i = 0; i < MEMCPY_SIZE; i++)
65 if (dst[i] != (unsigned char) i)
66 abort ();
68 exit (0);