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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20011113-1.c] - Blame information for rev 711

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

Line No. Rev Author Line
1 688 jeremybenn
typedef __SIZE_TYPE__ size_t;
2
extern void *memcpy (void *__restrict, const void *__restrict, size_t);
3
extern void abort (void);
4
extern void exit (int);
5
 
6
typedef struct t
7
{
8
  unsigned a : 16;
9
  unsigned b : 8;
10
  unsigned c : 8;
11
  long d[4];
12
} *T;
13
 
14
typedef struct {
15
  long r[3];
16
} U;
17
 
18
T bar (U, unsigned int);
19
 
20
T foo (T x)
21
{
22
  U d, u;
23
 
24
  memcpy (&u, &x->d[1], sizeof u);
25
  d = u;
26
  return bar (d, x->b);
27
}
28
 
29
T baz (T x)
30
{
31
  U d, u;
32
 
33
  d.r[0] = 0x123456789;
34
  d.r[1] = 0xfedcba987;
35
  d.r[2] = 0xabcdef123;
36
  memcpy (&u, &x->d[1], sizeof u);
37
  d = u;
38
  return bar (d, x->b);
39
}
40
 
41
T bar (U d, unsigned int m)
42
{
43
  if (d.r[0] != 21 || d.r[1] != 22 || d.r[2] != 23)
44
    abort ();
45
  return 0;
46
}
47
 
48
struct t t = { 26, 0, 0, { 0, 21, 22, 23 }};
49
 
50
int main (void)
51
{
52
  baz (&t);
53
  foo (&t);
54
  exit (0);
55
}

powered by: WebSVN 2.1.0

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