OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [memcpy-1.c] - Blame information for rev 297

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
#include <string.h>
2
 
3
#if defined (STACK_SIZE)
4
#define MEMCPY_SIZE (STACK_SIZE / 3)
5
#else
6
#define MEMCPY_SIZE (1 << 17)
7
#endif
8
 
9
 
10
void *copy (void *o, const void *i, unsigned l)
11
{
12
  return memcpy (o, i, l);
13
}
14
 
15
main ()
16
{
17
  unsigned i;
18
  unsigned char src[MEMCPY_SIZE];
19
  unsigned char dst[MEMCPY_SIZE];
20
 
21
  for (i = 0; i < MEMCPY_SIZE; i++)
22
    src[i] = (unsigned char) i,  dst[i] = 0;
23
 
24
  (void) memcpy (dst, src, MEMCPY_SIZE / 128);
25
 
26
  for (i = 0; i < MEMCPY_SIZE / 128; i++)
27
    if (dst[i] != (unsigned char) i)
28
      abort ();
29
 
30
  (void) memset (dst, 1, MEMCPY_SIZE / 128);
31
 
32
  for (i = 0; i < MEMCPY_SIZE / 128; i++)
33
    if (dst[i] != 1)
34
      abort ();
35
 
36
  (void) memcpy (dst, src, MEMCPY_SIZE);
37
 
38
  for (i = 0; i < MEMCPY_SIZE; i++)
39
    if (dst[i] != (unsigned char) i)
40
      abort ();
41
 
42
  (void) memset (dst, 0, MEMCPY_SIZE);
43
 
44
  for (i = 0; i < MEMCPY_SIZE; i++)
45
    if (dst[i] != 0)
46
      abort ();
47
 
48
  (void) copy (dst, src, MEMCPY_SIZE / 128);
49
 
50
  for (i = 0; i < MEMCPY_SIZE / 128; i++)
51
    if (dst[i] != (unsigned char) i)
52
      abort ();
53
 
54
  (void) memset (dst, 0, MEMCPY_SIZE);
55
 
56
  (void) copy (dst, src, MEMCPY_SIZE);
57
 
58
  for (i = 0; i < MEMCPY_SIZE; i++)
59
    if (dst[i] != (unsigned char) i)
60
      abort ();
61
 
62
  exit (0);
63
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.