Dead
[official-gcc.git] / gomp-20050608-branch / gcc / testsuite / gcc.c-torture / execute / builtins / 20010124-1-lib.c
blob5f6a7487fd8fb140d409f063ba224a326d2c630e
1 /* Verify that structure return doesn't invoke memcpy on
2 overlapping objects. */
4 extern void abort (void);
5 extern int inside_main;
6 typedef __SIZE_TYPE__ size_t;
8 struct S {
9 char stuff[1024];
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;
23 struct S f(struct S *p)
25 return *p;
28 void g(union U *p)
32 void *memcpy(void *a, const void *b, size_t len)
34 if (inside_main)
36 if (a < b && a+len > b)
37 abort ();
38 if (b < a && b+len > a)
39 abort ();
40 return a;
42 else
44 char *dst = (char *) a;
45 const char *src = (const char *) b;
46 while (len--)
47 *dst++ = *src++;
48 return a;