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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [builtins/] [20010124-1-lib.c] - Blame information for rev 825

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Verify that structure return doesn't invoke memcpy on
2
   overlapping objects.  */
3
 
4
extern void abort (void);
5
extern int inside_main;
6
typedef __SIZE_TYPE__ size_t;
7
 
8
struct S {
9
  char stuff[1024];
10
};
11
 
12
union U {
13
  struct {
14
    int space;
15
    struct S s;
16
  } a;
17
  struct {
18
    struct S s;
19
    int space;
20
  } b;
21
};
22
 
23
struct S f(struct S *p)
24
{
25
  return *p;
26
}
27
 
28
void g(union U *p)
29
{
30
}
31
 
32
void *memcpy(void *a, const void *b, size_t len)
33
{
34
  if (inside_main)
35
    {
36
      if (a < b && a+len > b)
37
        abort ();
38
      if (b < a && b+len > a)
39
        abort ();
40
      return a;
41
    }
42
  else
43
    {
44
      char *dst = (char *) a;
45
      const char *src = (const char *) b;
46
      while (len--)
47
        *dst++ = *src++;
48
      return a;
49
    }
50
}

powered by: WebSVN 2.1.0

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