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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 688 jeremybenn
/* Test case contributed by Ingo Rohloff <rohloff@in.tum.de>.
2
   Code distilled from Linux kernel.  */
3
 
4
/* Compile this program with a gcc-2.95.2 using
5
   "gcc -O2" and run it. The result will be that
6
   rx_ring[1].next == 0   (it should be == 14)
7
   and
8
   ep.skbuff[4] == 5      (it should be 0)
9
*/
10
 
11
extern void abort(void);
12
 
13
struct epic_rx_desc
14
{
15
  unsigned int next;
16
};
17
 
18
struct epic_private
19
{
20
  struct epic_rx_desc *rx_ring;
21
  unsigned int rx_skbuff[5];
22
};
23
 
24
static void epic_init_ring(struct epic_private *ep)
25
{
26
  int i;
27
 
28
  for (i = 0; i < 5; i++)
29
  {
30
    ep->rx_ring[i].next = 10 + (i+1)*2;
31
    ep->rx_skbuff[i] = 0;
32
  }
33
  ep->rx_ring[i-1].next = 10;
34
}
35
 
36
static int check_rx_ring[5] = { 12,14,16,18,10 };
37
 
38
int main(void)
39
{
40
  struct epic_private ep;
41
  struct epic_rx_desc rx_ring[5];
42
  int i;
43
 
44
  for (i=0;i<5;i++)
45
  {
46
    rx_ring[i].next=0;
47
    ep.rx_skbuff[i]=5;
48
  }
49
 
50
  ep.rx_ring=rx_ring;
51
  epic_init_ring(&ep);
52
 
53
  for (i=0;i<5;i++)
54
  {
55
    if ( rx_ring[i].next != check_rx_ring[i] ) abort();
56
    if ( ep.rx_skbuff[i] != 0 ) abort();
57
  }
58
  return 0;
59
}

powered by: WebSVN 2.1.0

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