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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [990811-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
struct s {long a; int b;};
2
 
3
int foo(int x, void *y)
4
{
5
  switch(x) {
6
    case 0: return ((struct s*)y)->a;
7
    case 1: return *(signed char*)y;
8
    case 2: return *(short*)y;
9
  }
10
  abort();
11
}
12
 
13
int main ()
14
{
15
  struct s s;
16
  short sh[10];
17
  signed char c[10];
18
  int i;
19
 
20
  s.a = 1;
21
  s.b = 2;
22
  for (i = 0; i < 10; i++) {
23
    sh[i] = i;
24
    c[i] = i;
25
  }
26
 
27
  if (foo(0, &s) != 1) abort();
28
  if (foo(1, c+3) != 3) abort();
29
  if (foo(2, sh+3) != 3) abort();
30
  exit(0);
31
}

powered by: WebSVN 2.1.0

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